diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-29 21:31:05 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-29 21:31:05 (GMT) |
commit | 83db7652ca7d218e7e9445fda759b747764c5a0c (patch) | |
tree | 41e04cc1daa223aefaaeb917ce12d0deab9fcac2 /Lib | |
parent | d2c184605e78d9eaf18a6ce83e4ac922bdd18057 (diff) | |
download | cpython-83db7652ca7d218e7e9445fda759b747764c5a0c.zip cpython-83db7652ca7d218e7e9445fda759b747764c5a0c.tar.gz cpython-83db7652ca7d218e7e9445fda759b747764c5a0c.tar.bz2 |
thanks to guido's bytecode verifier, this is fixed
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/crashers/bogus_sre_bytecode.py | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/Lib/test/crashers/bogus_sre_bytecode.py b/Lib/test/crashers/bogus_sre_bytecode.py deleted file mode 100644 index 4bfc730..0000000 --- a/Lib/test/crashers/bogus_sre_bytecode.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -The regular expression engine in '_sre' can segfault when interpreting -bogus bytecode. - -It is unclear whether this is a real bug or a "won't fix" case like -bogus_code_obj.py, because it requires bytecode that is built by hand, -as opposed to compiled by 're' from a string-source regexp. The -difference with bogus_code_obj, though, is that the only existing regexp -compiler is written in Python, so that the C code has no choice but -accept arbitrary bytecode from Python-level. - -The test below builds and runs random bytecodes until 'match' crashes -Python. I have not investigated why exactly segfaults occur nor how -hard they would be to fix. Here are a few examples of 'code' that -segfault for me: - - [21, 50814, 8, 29, 16] - [21, 3967, 26, 10, 23, 54113] - [29, 23, 0, 2, 5] - [31, 64351, 0, 28, 3, 22281, 20, 4463, 9, 25, 59154, 15245, 2, - 16343, 3, 11600, 24380, 10, 37556, 10, 31, 15, 31] - -Here is also a 'code' that triggers an infinite uninterruptible loop: - - [29, 1, 8, 21, 1, 43083, 6] - -""" - -import _sre, random - -def pick(): - n = random.randrange(-65536, 65536) - if n < 0: - n &= 31 - return n - -ss = ["", "world", "x" * 500] - -while 1: - code = [pick() for i in range(random.randrange(5, 25))] - print code - pat = _sre.compile(None, 0, code) - for s in ss: - try: - pat.match(s) - except RuntimeError: - pass |