This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: MemoryError in codeop.compile_command
Type: crash Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Leilei, ajoino, eric.smith, pablogsal
Priority: normal Keywords:

Created on 2022-03-27 12:10 by Leilei, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg416120 - (view) Author: qiu (Leilei) Date: 2022-03-27 12:10
Traceback (most recent call last):
  File "python_AFL.py", line 110, in runFuzzer
    runtime = runApplication(input_path, mode)
  File "python_AFL.py", line 75, in runApplication
    exec(f.read(), {'buff': input_data})    
  File "<string>", line 16, in <module>
  File "<string>", line 10, in fuzz
  File "/usr/lib/python3.6/codeop.py", line 122, in compile_command
    return _maybe_compile(_compile, source, filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 82, in _maybe_compile
    code = compiler(source, filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 102, in _compile
    return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT)
MemoryError

when I use codeop.compile_command( random input ), I get the error .
I wonder if I found the error with the Python codeop's library??
thanks!
msg416121 - (view) Author: Jacob Nilsson (ajoino) Date: 2022-03-27 12:46
Python 3.6 reach end of life in December 2021, is this error reproducible in Python 3.7 and above?

If that is still the case, do you have an example of an exact input causing this crash? "random input" is not a lot to go by.
msg416122 - (view) Author: qiu (Leilei) Date: 2022-03-27 12:59
9
msg416139 - (view) Author: qiu (Leilei) Date: 2022-03-28 00:06
hello,&nbsp;Did you get the E-mail about one random input I sent you?
one random input is
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[O[[[[[[[[[[[[[[[[[[[[[[[[[[[[[m[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[E[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[l[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[y[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[))
looking forward to your reply!&nbsp; thanks!

------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "Python tracker"                                                                                    <report@bugs.python.org&gt;;
发送时间:&nbsp;2022年3月27日(星期天) 晚上8:46
收件人:&nbsp;"邱磊磊"<1425166100@qq.com&gt;;

主题:&nbsp;[issue47137] MemoryError

Jacob Nilsson <jacob.nilsson@ltu.se&gt; added the comment:

Python 3.6 reach end of life in December 2021, is this error reproducible in Python 3.7 and above?

If that is still the case, do you have an example of an exact input causing this crash? "random input" is not a lot to go by.

----------
nosy: +ajoino

_______________________________________
Python tracker <report@bugs.python.org&gt;
<https://bugs.python.org/issue47137&gt;
_______________________________________
msg416162 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2022-03-28 12:17
A simpler reproducer is:
codeop.compile_command('[' * 100)

Verified I get MemoryError on cygwin PYthon 3.8.12. A length of 99 does not show a problem.

On Windows 3.11.0a5+, I get:

>>> codeop.compile_command('[' * 201)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\home\eric\local\python\cpython\Lib\codeop.py", line 107, in compile_command
    return _maybe_compile(_compile, source, filename, symbol)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\home\eric\local\python\cpython\Lib\codeop.py", line 70, in _maybe_compile
    compiler(source + "\n", filename, symbol)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\home\eric\local\python\cpython\Lib\codeop.py", line 86, in _compile
    return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT | PyCF_ALLOW_INCOMPLETE_INPUT)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<input>", line 1
    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

                                                                        ^
SyntaxError: too many nested parentheses

A length of 200 seems to work correctly.

So it looks like this was fixed somewhere along the line, I'm guessing with the PEG parser. I suspect backporting the fix to older versions won't be possible.
msg416166 - (view) Author: qiu (Leilei) Date: 2022-03-28 13:02
y
msg416224 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2022-03-28 22:29
> I suspect backporting the fix to older versions won't be possible.

Yeah, very much the case unfortunately
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91293
2022-03-28 22:32:41eric.smithsetstatus: open -> closed
resolution: wont fix
stage: resolved
2022-03-28 22:29:24pablogsalsetmessages: + msg416224
2022-03-28 21:08:15eric.smithsetnosy: + pablogsal
title: MemoryError -> MemoryError in codeop.compile_command

versions: + Python 3.8
2022-03-28 13:02:52Leileisetmessages: + msg416166
2022-03-28 12:17:39eric.smithsetnosy: + eric.smith
messages: + msg416162
2022-03-28 00:06:41Leileisetmessages: + msg416139
2022-03-27 12:59:58Leileisetmessages: + msg416122
2022-03-27 12:46:06ajoinosetnosy: + ajoino
messages: + msg416121
2022-03-27 12:10:28Leileicreate