Closed
Description
Bug report
Bug description:
The re
module's documentation says it only raises the re.error
exception, but the regex "\x00(?<!\x00{2147483648})"
causes RuntimeError:
Python 3.11.5 (main, Sep 20 2023, 10:46:56) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.compile("\x00(?<!\x00{2147483647})")
re.compile('\x00(?<!\x00{2147483647})')
>>>
>>>
>>> re.compile("\x00(?<!\x00{2147483648})")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.11/re/__init__.py", line 227, in compile
return _compile(pattern, flags)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/re/__init__.py", line 294, in _compile
p = _compiler.compile(pattern, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/re/_compiler.py", line 759, in compile
return _sre.compile(
^^^^^^^^^^^^^
RuntimeError: invalid SRE code
Other re
methods, such as match
or split
show the same result.
For brevity:
"\x00(?<!\x00{2147483648})"
-> RuntimeError
"\x00(?<!\x00{2147483647})"
-> no errors
I have found this with libFuzzer by testing the fuzz_sre_compile
binary.
CPython versions tested on:
3.11
Operating systems tested on:
Linux