Skip to content

Replace oversized int literals with 0 to avoid json.dumps 4300-digit conversion limit#35

Merged
ParzivalHack merged 1 commit intoParzivalHack:mainfrom
satoridev01:fix-large-int-serialization
Feb 11, 2026
Merged

Replace oversized int literals with 0 to avoid json.dumps 4300-digit conversion limit#35
ParzivalHack merged 1 commit intoParzivalHack:mainfrom
satoridev01:fix-large-int-serialization

Conversation

@satoridev01
Copy link
Copy Markdown
Contributor

When PySpector processes the following:

https://github.com/SheafificationOfG/BoolosBrewery/blob/18670136ed43ca9ed30bf6b701b47fc48307bfa7/submissions/public/hard/20241015_010940_viliml_simpler_sat.py#L7

A stacktrace is shown:
satori run satori://code/python/pyspector.yml --repo SheafificationOfG/BoolosBrewery --output

image

When ast.parse() parses the file, it creates AST Constant nodes with those huge integers. Then json.dumps() tries to convert them to strings and hits Python 3.12's int-to-string security limit (CVE-2020-10735), which caps conversions at 4,300 digits by default.

This is a bug in PySpector's AstEncoder — it should handle huge integers gracefully instead of letting json.dumps crash. The fix would be in cli.py's AstEncoder.default() method, converting very large ints to a 0 before serialization.

With this fix, it is possible to parse that repo:
image

@ParzivalHack ParzivalHack added bug Something isn't working enhancement New feature or request labels Feb 11, 2026
Copy link
Copy Markdown
Owner

@ParzivalHack ParzivalHack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @satoridev01, thanks for the PR, merging this one directly as i require not further changes. Thx again :)

@ParzivalHack ParzivalHack merged commit c50da21 into ParzivalHack:main Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants