{{ message }}
Repository navigation
Add PyExc_OverflowError to the list of possible exceptions in fuzz_ast_literal_eval fuzzer - #145429
Merged
Merged
Conversation
ammaraskar
approved these changes
Mar 2, 2026
ammaraskar
left a comment
Member
There was a problem hiding this comment.
Looks good to ignore this, we don't particularly care about overflow here.
ljfp
pushed a commit
to ljfp/cpython
that referenced
this pull request
Apr 25, 2026
…_ast_literal_eval` fuzzer (pythonGH-145429)
Member
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
This comment was marked as outdated.
This comment was marked as outdated.
|
GH-158083 is a backport of this pull request to the 3.13 branch. |
|
GH-158084 is a backport of this pull request to the 3.14 branch. |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This fixes the "bug" found in https://oss-fuzz.com/testcase-detail/5450638250278912.
>>> import ast ... data = open('/tmp/testcase', 'rb').read() ... ast.literal_eval(data[:data.index(0)].decode()) ... <python-input-2>:2: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/testcase'> ResourceWarning: Enable tracemalloc to get the object allocation traceback Traceback (most recent call last): File "<python-input-2>", line 3, in <module> ast.literal_eval(data[:data.index(0)].decode()) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/stan/dev/cpython/Lib/ast.py", line 64, in literal_eval return _convert_literal(node_or_string) File "/home/stan/dev/cpython/Lib/ast.py", line 108, in _convert_literal return left + right ~~~~~^~~~~~~ OverflowError: int too large to convert to floatWith fuzzer
Currently:
With fix: