Skip to content

Overflow if ast.AST.end_col_offset is absurdly large #126860

@federicovalenso

Description

@federicovalenso

Bug report

Bug description:

c = ast.parse('x = 1')
c.body[0].end_col_offset = 2**31-1
c.body[0].end_col_offset
2147483647
code = compile(c, "", "exec")

It leads to overflow in _PyPegen_raise_error. This is also true for col_offset (just replace c.body[0].end_col_offset)

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions