From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0034F3858D39; Thu, 8 Sep 2022 11:43:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0034F3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1662637434; bh=vDJCLDletSmProELUuYw+qlHinpjR9LQmqjQNmM97pU=; h=From:To:Subject:Date:From; b=yECTGIxBwZHdP7Snuy+TzUUz0KWA/g+XanLymPzyTi9HMxZhkiFLFU9pVakRic3Yt yePCyqsvpNTW/sVjjXusREoe10FUFoEqdbr4ezHstUxv6j4l62TLoV8QAKnqhp8OvG +r/xBkNk2cCEOjPOy9fdkBO1vsf94fgPJGfCkz7U= From: "vincent-srcware at vinc17 dot net" To: glibc-bugs-regex@sourceware.org Subject: [Bug regex/29560] New: Wrong result with backreferences (test for non-prime numbers) Date: Thu, 08 Sep 2022 11:43:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: regex X-Bugzilla-Version: 2.31 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-srcware at vinc17 dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29560 Bug ID: 29560 Summary: Wrong result with backreferences (test for non-prime numbers) Product: glibc Version: 2.31 Status: UNCONFIRMED Severity: normal Priority: P2 Component: regex Assignee: unassigned at sourceware dot org Reporter: vincent-srcware at vinc17 dot net CC: drepper.fsp at gmail dot com Target Milestone: --- Created attachment 14327 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14327&action=3Ded= it Testcase written in C zira:~> echo "1111111111111" | grep --color=3Dalways -E '^(11+)\1+$|^1?$' 1111111111111 with no colors, i.e. the matched portion is empty. This is incorrect: there shouldn't be any match, as there are 13 digits 1 and 13 is a prime number. This bug was initially reported in 2017 here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D884075 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D29613 It was also added in Bug 11053 comment 6, but Bug 11053 was actually a different bug. If the "|^1?$" part is replaced by "|^$" (matching an empty string), the is= sue still occurs, but if I remove it or replace it by a regexp that cannot matc= h an empty string, the issue no longer occurs. I've attached a testcase written in C (almost the same as the one from Bug 11053 comment 6), using regcomp and regexec. This bug is still there in glibc 2.35 (Ubuntu 22.04.1 LTS / riscv64). --=20 You are receiving this mail because: You are on the CC list for the bug.=