Skip to content

πŸ› fix(python): bound base_python_file reads - #4325

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
rahuldevikar:radevika-microsoft-fix-invalid-base-python-file
Oct 30, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
rahuldevikar:radevika-microsoft-fix-invalid-base-python-file

Conversation

@rahuldevikar

@rahuldevikar rahuldevikar commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

An oversized first line in base_python_file could consume hundreds of MiB and echo the line in tox output; a directory or undecodable file could raise an unhandled error (#4243). tox now bounds version-line reads and reports a handled input error naming the file.

The version-file reader checks file type and decoding at the read boundary, skips long comments and blank lines in bounded chunks, and passes a version line of at most 1024 characters to Python discovery. Fixes #4243.

@gaborbernat gaborbernat added the bug A confirmed defect label Oct 30, 2026
@gaborbernat gaborbernat changed the title fix(python): bound and validate base_python_file reads πŸ› fix(python): bound base_python_file reads Oct 30, 2026
rahuldevikar and others added 2 commits October 30, 2026 10:44
Reject non-regular files, undecodable content and over-long version lines with a handled error instead of loading the whole file and stalling Python discovery.
The bounded reader rejected long blank lines and indented comments
that the previous parser ignored. Scan those lines in bounded chunks
before selecting the first version.
@rahuldevikar
rahuldevikar force-pushed the radevika-microsoft-fix-invalid-base-python-file branch from 8b9026f to 33192d0 Compare October 30, 2026 17:44
@gaborbernat
gaborbernat merged commit 151beaa into tox-dev:main Oct 30, 2026
26 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A confirmed defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid base_python_file crashes or stalls tox

2 participants