`MemoryError` during parse can escalate to `SystemError` and abort on small input
未關閉
還沒有人認領這個 Issue。
interpreter-core
topic-parser
type-crash
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Crash report
What happened?
string = (
b'(*h(((h(h(h(' +
b'[' * 35 +
b'*h(' +
b'[' * 38 +
b'**h(' +
b'[' * 31 +
b'(' * 4 +
b'~' * 20 +
b'F{' +
b'[' * 27 +
b'**h(' +
b'[' * 31 +
b'(' * 4 +
b'~' * 23 +
b'F{F"{F"{F"{F"{F"{F"{F"{FF""{{F"{""{F"{F{{F"{F"{F"\\}'
)
compile(string, "<input>", "single")
Gives me:
Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set
Python runtime state: initialized
MemoryError: Parser stack overflowed - Python source too complex to parse
The above exception was the direct cause of the following exception:
SystemError: <class 'SyntaxWarning'> returned a result with an exception set
Current thread 0x00007efd1b8e8780 [python] (most recent call first):
File "/tmp/repro.py", line 19 in <module>
Aborted (core dumped) ./python /tmp/repro.py
Found by OSS-Fuzz.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Output from running 'python -VV' on the command line:
No response
Linked PRs
- gh-150067
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
在 CPython main 上執行提供的 compile() 重現程式,並將其 MemoryError/SystemError 失敗與回報的致命中止進行比較。閱讀涉及的 parser 和 SyntaxWarning 處理,然後檢視連結的 PR gh-150067。當輸入不再中止直譯器,也不再將 parser 錯誤升級為 SystemError 時,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- compilers
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 20/100