Fix possible negative index possibility in pcre2test.
This commit is contained in:
parent
4db9b51ce0
commit
16acce6555
|
@ -134,6 +134,8 @@ RunTest (see 4 above).
|
||||||
|
|
||||||
34. Fix comment describing the returns from find_fixedlength().
|
34. Fix comment describing the returns from find_fixedlength().
|
||||||
|
|
||||||
|
35. Fix potential negative index in pcre2test.
|
||||||
|
|
||||||
|
|
||||||
Version 10.21 12-January-2016
|
Version 10.21 12-January-2016
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
|
@ -3016,9 +3016,13 @@ for (;;)
|
||||||
}
|
}
|
||||||
|
|
||||||
dlen = strlen((char *)here);
|
dlen = strlen((char *)here);
|
||||||
if (here[dlen - 1] == '\n') return start; /* End of line reached */
|
|
||||||
here += dlen;
|
here += dlen;
|
||||||
|
|
||||||
|
/* Check for end of line reached. Take care not to read data from before
|
||||||
|
start (dlen will be zero for a file starting with a binary zero). */
|
||||||
|
|
||||||
|
if (here > start && here[-1] == '\n') return start;
|
||||||
|
|
||||||
/* If we have not read a newline when reading a file, we have either filled
|
/* If we have not read a newline when reading a file, we have either filled
|
||||||
the buffer or reached the end of the file. We can detect the former by
|
the buffer or reached the end of the file. We can detect the former by
|
||||||
checking that the string fills the buffer, and the latter by feof(). If
|
checking that the string fills the buffer, and the latter by feof(). If
|
||||||
|
|
Loading…
Reference in New Issue