libc: regexec(3) adjustment.
commitbcd6e4b33313419b08cb0f38ef7a532fcc5ccb66
authorpfg <pfg@FreeBSD.org>
Wed, 25 May 2016 15:35:23 +0000 (25 15:35 +0000)
committerpfg <pfg@FreeBSD.org>
Wed, 25 May 2016 15:35:23 +0000 (25 15:35 +0000)
tree9365514364163f895295e9e8897f45c1f7b9e8e4
parent010eabe65eeeda35634480f8693454f5a6f43d67
libc: regexec(3) adjustment.

Change the behavior of when REG_STARTEND is combined with REG_NOTBOL.

From the original posting[1]:

"Enable the assumption that pmatch[0].rm_so is a continuation offset
to  a string and allows us to do a proper assessment of the character
in  regards to it's word position ('^' or '\<'), without risking going
into unallocated memory."

This change makes us similar to how glibc handles REG_STARTEND |
REG_NOTBOL, and is closely related to a soon-to-land fix to sed.

Special thanks to Martijn van Duren and Ingo Schwarze for working
out some consistent behaviour.

Differential Revision: https://reviews.freebsd.org/D6257
Taken from: openbsd-tech 2016-05-24 [1]  (Martijn van Duren)
Relnotes: yes
MFC after: 1 month
lib/libc/regex/engine.c
lib/libc/regex/regex.3