]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-47256: Increasing the depth of backtracking in RE (GH-32411)
authorMa Lin <animalize@users.noreply.github.com>
Mon, 18 Apr 2022 13:50:40 +0000 (21:50 +0800)
committerGitHub <noreply@github.com>
Mon, 18 Apr 2022 13:50:40 +0000 (16:50 +0300)
commita29f858124bc698f6604716b73306c65b63b5054
tree4ad90bf4967c3f0dd3e0981a65f31089a8920f0a
parent1c2fcebf3c5e2ab41d376bb481834445617c8f3c
bpo-47256: Increasing the depth of backtracking in RE (GH-32411)

Limit the maximum capturing group to 2**30-1 on 64-bit platforms
(it was 2**31-1). No change on 32-bit platforms (2**28-1).

It allows to reduce the size of SRE(match_context):
- On 32 bit platform: 36 bytes, no change.  (msvc2022)
- On 64 bit platform: 72 bytes -> 56 bytes. (msvc2022/gcc9.4)

which leads to increasing the depth of backtracking.
Misc/NEWS.d/next/Library/2022-04-16-11-39-59.bpo-47256.1cygyd.rst [new file with mode: 0644]
Modules/_sre/sre.h
Modules/_sre/sre_lib.h