Fix small bug in pcre2grep (no effect other than a sanitizer warning).

This commit is contained in:
Philip.Hazel 2018-09-10 17:34:19 +00:00
parent 3e6f016907
commit ab30606b01
2 changed files with 11 additions and 3 deletions

View File

@ -2,8 +2,8 @@ Change Log for PCRE2
-------------------- --------------------
Version 10.32-RC1 13-August-2018 Version 10.32-RC1 10-September-2018
-------------------------------- -----------------------------------
1. When matching using the the REG_STARTEND feature of the POSIX API with a 1. When matching using the the REG_STARTEND feature of the POSIX API with a
non-zero starting offset, unset capturing groups with lower numbers than a non-zero starting offset, unset capturing groups with lower numbers than a
@ -189,6 +189,14 @@ pattern, but the behaviour is now consistent.
(for an event that could never occur but you had to have external information (for an event that could never occur but you had to have external information
to know that). to know that).
42. If before the first match in a file that was being searched by pcre2grep
there was a line that was sufficiently long to cause the input buffer to be
expanded, the variable holding the location of the end of the previous match
was being adjusted incorrectly, and could cause an overflow warning from a code
sanitizer. However, as the value is used only to print pending "after" lines
when the next match is reached (and there are no such lines in this case) this
bug could do no damage.
Version 10.31 12-February-2018 Version 10.31 12-February-2018
------------------------------ ------------------------------

View File

@ -2364,7 +2364,7 @@ int filepos = 0;
unsigned long int linenumber = 1; unsigned long int linenumber = 1;
unsigned long int lastmatchnumber = 0; unsigned long int lastmatchnumber = 0;
unsigned long int count = 0; unsigned long int count = 0;
char *lastmatchrestart = NULL; char *lastmatchrestart = main_buffer;
char *ptr = main_buffer; char *ptr = main_buffer;
char *endptr; char *endptr;
PCRE2_SIZE bufflength; PCRE2_SIZE bufflength;