[PATCH v7 2/3] posix: regexec(): fix REG_STARTEND, pmatch->rm_so != 0 w/^ anchor

наб nabijaczleweli@nabijaczleweli.xyz
Mon Jun 12 14:03:02 GMT 2023


On Mon, Jun 12, 2023 at 09:11:54AM -0400, Carlos O'Donell wrote:
> On 6/11/23 20:47, наб wrote:
> > re_search_internal () starts with
> >   /* If initial states with non-begbuf contexts have no elements,
> >      the regex must be anchored.  If preg->newline_anchor is set,
> >      we'll never use init_state_nl, so do not check it.  */
> >   if (dfa->init_state->nodes.nelem == 0
> >       && dfa->init_state_word->nodes.nelem == 0
> >       && (dfa->init_state_nl->nodes.nelem == 0
> > 	  || !preg->newline_anchor))
> >     {
> >       if (start != 0 && last_start != 0)
> >         return REG_NOMATCH;
> >       start = last_start = 0;
> >     }
> > and heretofor start and last_start (for example when "abc", {1, 2},
> > so matching just the "b") were != 0, and the return was taken for a "^b"
> > regex, which is erroneous.
> > 
> > Fix this by giving re_search_internal (string+rm_so, start=0),
> > then fixing up the returned matches in an after-pass.
> > 
> > This brings us to compatibility with the BSD spec and implementations.
> > 
> > Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
> 
> These changes are being made to sources shared between gnulib and glibc.
> 
> As the files are listed in SHARED-SOURCES we cannot easily accept changes to them
> via DCO since they should be shared with gnulib which still requires copyright
> assignment.
> 
> Would you be willing to disclaim these changes or assign copyright?

Quite happy to disclaim all patches here, yeah;
the process itself is unclear to me, however. 

Best,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20230612/e517ada9/attachment.sig>


More information about the Libc-alpha mailing list