-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Bug report] Endless looping in pcre2test (v10.41, commit id:3a1ad4 ) #141
Comments
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. |
This was referenced Jan 16, 2025
This was referenced Jan 23, 2025
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Bug Description
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).
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_t
while
entry condition is vulnerable. With needlen ∈ [ 2 ^ 63, 2 ^ 64), thewhile
is very easy to trap into endless looping.How to reproduce
./autogen.sh
CC=gcc CXX=g++ ./configure --disable-shared --prefix=...
make -j 8
make install
cd <your install directory>
./bin/pcre2test <any input file in the zip>
The text was updated successfully, but these errors were encountered: