-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-regextype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Bug report
Bug description:
The re.Scanner class crashes with a segmentation fault (memory corruption) when any pattern in the lexicon contains named capturing groups.
import re
lexicon = [
('(?P<group1>a)(?P<group2>b)', None), # Named capturing groups
]
scanner = re.Scanner(lexicon)
result, leftover = scanner.scan("ab") # Segmentation fault occurs herezsh: segmentation fault python3 test.pyScanner should process the input normally and return scan results without crashing, but Python interpreter crashes with segmentation fault, indicating memory corruption.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
- gh-140797: Forbid capturing groups in re.Scanner lexicon patterns #140944
- [3.14] gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) #140982
- [3.13] gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) #140983
- gh-140979: Fix off-by-one error in the RE code validator #140984
- [3.13] Revert "[3.13] gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) (GH-140983)" #142231
- [3.14] Revert "gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) (GH-140982)" #142309
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-regextype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump