mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-29 21:26:51 +00:00
altoffset() always returned whenever it recursed, because at the end
of the processing of the recursion, "scan" would be pointing to O_CH (or O_QUEST), which would then be interpreted as being the end character for altoffset(). We avoid this by properly increasing scan before leaving the switch. Without this, something like (a?b?)?cc would result in a g->moffset of 1 instead of 2. I added a case to the soon-to-be-imported regex(3) test code to catch this error.
This commit is contained in:
parent
b6c1a56180
commit
8f9e434f46
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=62855
|
@ -1891,6 +1891,10 @@ int mccs;
|
|||
OP(s) != OOR2)
|
||||
return -1;
|
||||
} while (OP(s) != O_QUEST && OP(s) != O_CH);
|
||||
/* We must skip to the next position, or we'll
|
||||
* leave altoffset() too early.
|
||||
*/
|
||||
scan++;
|
||||
break;
|
||||
case OANYOF:
|
||||
if (mccs)
|
||||
|
|
Loading…
Reference in a new issue