[Bug regex/21673] New: a regexec call with REG_STARTEND finds a bogus match for \>

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Bug regex/21673] New: a regexec call with REG_STARTEND finds a bogus match for \>

macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21673

            Bug ID: 21673
           Summary: a regexec call with REG_STARTEND finds a bogus match
                    for \>
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regex
          Assignee: unassigned at sourceware dot org
          Reporter: bensberg at telfort dot nl
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 10222
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10222&action=edit
tiny program that searches for \> starting from two different positions

When calling regexec with the REG_STARTEND flag and providing
an end-of-range value (in .rm_eo) that points to somewhere in
the middle of a word, regexec will nevertheless find a match
for \> at that offset.  The corresponding case for \<, with a
start-of-range value (in .rm_so) that points to the middle of
a word, will /not/ find a match for \< there.  The latter is
what I expected, the former was a surprise.

To reproduce:
Compile the attached until.c and run it.

The actual output is:
Found tail at 6: '.  '
Found tail at 4: 'rd.  '

Expected result:
The second line of output shouldn't have been there, because
the word does not end after "wo".

First seen on Ubuntu Lucid (10.04).  Still present on Ubuntu
Zesty (17.04, glibc 2.24).

--
You are receiving this mail because:
You are on the CC list for the bug.