Skip to content

gh-129409: Fix Integer overflow - SEGV while writing data more than 2GB in CSV file #129413

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

Merged
merged 7 commits into from
Jan 29, 2025

Conversation

srinivasreddy
Copy link
Contributor

@srinivasreddy srinivasreddy commented Jan 28, 2025

@srinivasreddy srinivasreddy marked this pull request as ready for review January 28, 2025 17:05
@srinivasreddy srinivasreddy marked this pull request as draft January 28, 2025 17:22
@srinivasreddy srinivasreddy changed the title gh-129409: Fix Integer overflow - aka SEGV while writing data more than 2GB in CSV file gh-129409: Fix Integer overflow - SEGV while writing data more than 2GB in CSV file Jan 28, 2025
@@ -1560,6 +1560,20 @@ def test_ordered_dict_reader(self):
OrderedDict([('fname', 'John'), ('lname', 'Cleese')]),
])

class HugeDataTest(unittest.TestCase):
def test_write_huge_data(self):
Copy link
Member

Choose a reason for hiding this comment

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

This test should probably be guarded with support.requires("largefile", ...) so that it only runs when the resource is enabled via python -m test -u largefile

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer not to test this, 2GB files are too much for this kind of change.

Copy link
Member

Choose a reason for hiding this comment

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

Not disagreeing, but would you mind elaborating on why we shouldn't test this, just for future reference? 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Tests are rather hard to reason about. I would put it this way: since it is a very slow and heavy test that tests an integer overflow. It is not specific to any arch / os / runtime / etc.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense, thanks for the explanation :)

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

I vote for removing this test.

@bedevere-app
Copy link

bedevere-app bot commented Jan 28, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@srinivasreddy srinivasreddy marked this pull request as ready for review January 29, 2025 05:58
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Please, add a NEWS entry, this is a user-facing bug.

Comment on lines 1 to 2
Fixed a segmentation fault in the :mod:`csv` module when writing data fields
larger than 2GB due to integer overflow.
Copy link
Member

Choose a reason for hiding this comment

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

A bit more concise:

Suggested change
Fixed a segmentation fault in the :mod:`csv` module when writing data fields
larger than 2GB due to integer overflow.
Fix an integer overflow in the :mod:`csv` module when writing data
larger than 2GB.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you!

@sobolevn sobolevn added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Jan 29, 2025
@sobolevn sobolevn enabled auto-merge (squash) January 29, 2025 11:06
@sobolevn sobolevn merged commit 97b0ef0 into python:main Jan 29, 2025
49 checks passed
@miss-islington-app
Copy link

Thanks @srinivasreddy for the PR, and @sobolevn for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 29, 2025
…than 2GB in CSV file (pythonGH-129413)

(cherry picked from commit 97b0ef0)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jan 29, 2025

GH-129436 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 29, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 29, 2025
…than 2GB in CSV file (pythonGH-129413)

(cherry picked from commit 97b0ef0)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jan 29, 2025

GH-129437 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Jan 29, 2025
sobolevn pushed a commit that referenced this pull request Jan 29, 2025
… than 2GB in CSV file (GH-129413) (#129437)

gh-129409: Fix Integer overflow -  SEGV while writing data more than 2GB in CSV file (GH-129413)
(cherry picked from commit 97b0ef0)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
sobolevn pushed a commit that referenced this pull request Jan 29, 2025
… than 2GB in CSV file (GH-129413) (#129436)

gh-129409: Fix Integer overflow -  SEGV while writing data more than 2GB in CSV file (GH-129413)
(cherry picked from commit 97b0ef0)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
@srinivasreddy srinivasreddy deleted the gh-129409 branch January 29, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants