You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we find 151 input files and pcre2test could not terminate in 60 minutes while processing them, which may trigger some dead loops.
We select one simplest input file (decompress it) to analyze the bug and the results of our analysis are as follows. (Maybe there are other situations.)
Bug Analysis
We find an endless looping may in pcre2test.c:6860
With the input (decompress it).
--
\[X]{-10}
The relevant code snippet is as follows.
li=strtol((constchar*)p, &endptr, 10);
i= (int32_t)li;
if (i--==0) {// ...}// ...replen=CAST8VAR(q) -start_rep;
needlen+=replen*i;
if (needlen >= dbuffer_size)
{
// ...6860: while (needlen >= dbuffer_size) dbuffer_size *= 2;
// ...
}
p = "-10", li = i = -10
With i--, i = -11
With replen = CAST8VAR(q) - start_rep;, replen = 1
With initial value 10 and needlen += replen * i, needlen = -1 = 2 ^ 64 -1, as type(needlen) = size_t
Then an endless looping occurs in line: 6860.
In fact, the while entry condition is vulnerable. With needlen ∈ [ 2 ^ 63, 2 ^ 64), the while is very easy to trap into endless looping.
How to reproduce
Download the pcre2 source code with the official link and build it.
Thank you for the report and diagnosis. This was, of course, a simple oversight in pcre2test. I have committed a patch that gives an error if a negative repetition count is encountered.
Bug Description
Hi, we find 151 input files and
pcre2testcould not terminate in 60 minutes while processing them, which may trigger some dead loops.We select one simplest input file (decompress it) to analyze the bug and the results of our analysis are as follows. (Maybe there are other situations.)
Bug Analysis
We find an endless looping may in
pcre2test.c:6860With the input (decompress it).
The relevant code snippet is as follows.
p= "-10",li=i= -10i--,i= -11replen = CAST8VAR(q) - start_rep;,replen= 1needlen += replen * i,needlen= -1 = 2 ^ 64 -1, as type(needlen) =size_twhileentry condition is vulnerable. With needlen ∈ [ 2 ^ 63, 2 ^ 64), thewhileis very easy to trap into endless looping.How to reproduce
./autogen.shCC=gcc CXX=g++ ./configure --disable-shared --prefix=...make -j 8make installcd <your install directory>./bin/pcre2test <any input file in the zip>The text was updated successfully, but these errors were encountered: