-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
integer overflow in the _csv module's join_append_data function #71945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thomas E Hybel on PSRT reports: This vulnerability is an integer overflow leading to a heap buffer overflow. I The vulnerability resides in the Modules/_csv.c file, in the join_append and join_append initially calls join_append_data with copy_phase=0 to compute the The root issue is that join_append_data does not check for overflow when Note that there is already a check in join_append for whether (rec_len < 0). But After the overflow happens, rec_len is a small integer, and thus when Thus join_append_data writes the remaining data out-of-bounds of the self->rec Further details: Tested version: Python-3.5.2, 32 bits Proof-of-concept reproducer script (32-bits only): --- begin script --- import _csv
class MockFile:
def write(self, _):
pass
writer = _csv.writer(MockFile())
writer.writerow(["A"*0x10000, '"'*0x7fffff00]) --- end script --- Python (configured with --with-pydebug) segfaults when the script is run. A (gdb) r |
New changeset fdae903db33a by Benjamin Peterson in branch '2.7': New changeset afa356402217 by Benjamin Peterson in branch '3.3': New changeset 10b89df93c58 by Benjamin Peterson in branch '3.4': New changeset 55e8d3e542bd by Benjamin Peterson in branch '3.5': New changeset 609b554dd4a2 by Benjamin Peterson in branch 'default': |
Thanks for fixing this. I looked at the patch and it seems correct. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: