From ab30606b01d125c433423b837e6eb42816d19a56 Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Mon, 10 Sep 2018 17:34:19 +0000 Subject: [PATCH] Fix small bug in pcre2grep (no effect other than a sanitizer warning). --- ChangeLog | 12 ++++++++++-- src/pcre2grep.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9394aaf..3f92e6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 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 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 ------------------------------ diff --git a/src/pcre2grep.c b/src/pcre2grep.c index 6c7c2a7..d5f34c8 100644 --- a/src/pcre2grep.c +++ b/src/pcre2grep.c @@ -2364,7 +2364,7 @@ int filepos = 0; unsigned long int linenumber = 1; unsigned long int lastmatchnumber = 0; unsigned long int count = 0; -char *lastmatchrestart = NULL; +char *lastmatchrestart = main_buffer; char *ptr = main_buffer; char *endptr; PCRE2_SIZE bufflength;