GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-113977, gh-120754: Remove unbounded reads from zipfile by cmaloney · Pull Request #122101 · python/cpython

Conversation

@cmaloney

@cmaloney cmaloney commented Jul 21, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Read without a size may read an unbounded amount of data + allocate unbounded size buffers. Move to capped size reads to prevent potential issues.

This is a followup #121593 (comment). I don't think this needs a separate news entry.

  • Issue: Speed up open().read() pattern by reducing the number of system calls #120754
  • Issue: Unbounded reads by zipfile may cause a MemoryError. #113977

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cmaloney
pythonGH-120754: Remove unbounded reads from zipfile
1c1c5a3
Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.
@bedevere-app bedevere-app Bot mentioned this pull request Jul 21, 2024
Speed up open().read() pattern by reducing the number of system calls #120754
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Jul 21, 2024
@cmaloney cmaloney mentioned this pull request Jul 21, 2024
GH-120754: Remove isatty call during regular open #121593
Closed
@picnixz picnixz added the skip news label Jul 22, 2024
@picnixz

picnixz commented Jul 22, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Ah maybe not a skip news actually. I'll leave the decision to someone else.

cmaloney reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz removed the skip news label Jul 22, 2024
picnixz
picnixz reviewed Jul 22, 2024
View reviewed changes
Comment thread Lib/zipfile/__init__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

danifus
danifus reviewed Jul 22, 2024
View reviewed changes
Comment thread Lib/zipfile/__init__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/zipfile/__init__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/zipfile/__init__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

cmaloney and others added 2 commits July 22, 2024 11:33
@cmaloney @danifus
Update Lib/zipfile/__init__.py
08cdd79
Co-authored-by: Daniel Hillier <[email protected]>
@cmaloney @danifus
Update Lib/zipfile/__init__.py
8961b0b
Co-authored-by: Daniel Hillier <[email protected]>
danifus
danifus approved these changes Jul 23, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Jul 23, 2024
cmaloney and others added 2 commits July 22, 2024 19:16
@cmaloney @danifus
Don't require reading an EOF
6dc8a0b
The seek just before this _should_ result in this read hitting EOF here or getting less bytes.

Co-authored-by: Daniel Hillier <[email protected]>
@blurb-it
📜🤖 Added by blurb_it.
0d6151e
danifus
danifus approved these changes Jul 23, 2024
View reviewed changes
@danifus danifus mentioned this pull request Aug 5, 2024
Unbounded reads by zipfile may cause a MemoryError. #113977
Closed
@cmaloney cmaloney changed the title GH-120754: Remove unbounded reads from zipfile gh-113977, gh-120754: Remove unbounded reads from zipfile Sep 10, 2024
@cmaloney cmaloney mentioned this pull request Sep 18, 2024
gh-120754: Refactor I/O modules to stash whole stat result rather than individual members #123412
Merged
@cmaloney
Merge branch 'main' into cmaloney/zipfile_tweaks
7f78854
gpshead
gpshead approved these changes Nov 3, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Nov 3, 2024
@gpshead
gpshead merged commit 556dc9b into python:main Nov 3, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 3, 2024
@gpshead gpshead added needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Nov 3, 2024
@miss-islington-app

miss-islington-app Bot commented Nov 3, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented Nov 3, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 3, 2024
@cmaloney @danifus
@blurb-it @miss-islington
pythongh-113977, pythongh-120754: Remove unbounded reads from zipfile (…
7ea6fd2
…pythonGH-122101)

pythonGH-113977, pythonGH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

(cherry picked from commit 556dc9b)

Co-authored-by: Cody Maloney <[email protected]>
Co-authored-by: Daniel Hillier <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 3, 2024
@cmaloney @danifus
@blurb-it @miss-islington
pythongh-113977, pythongh-120754: Remove unbounded reads from zipfile (…
f17af1e
…pythonGH-122101)

pythonGH-113977, pythonGH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

(cherry picked from commit 556dc9b)

Co-authored-by: Cody Maloney <[email protected]>
Co-authored-by: Daniel Hillier <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
@bedevere-app

bedevere-app Bot commented Nov 3, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Nov 3, 2024
@bedevere-app

bedevere-app Bot commented Nov 3, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Nov 3, 2024
@cmaloney
cmaloney deleted the cmaloney/zipfile_tweaks branch November 3, 2024 05:46
gpshead pushed a commit that referenced this pull request Nov 3, 2024
@miss-islington @cmaloney
@danifus @blurb-it
[3.12] gh-113977, gh-120754: Remove unbounded reads from zipfile (GH-…
6e3e91f
…122101) (#126347)

gh-113977, gh-120754: Remove unbounded reads from zipfile (GH-122101)

GH-113977, GH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

(cherry picked from commit 556dc9b)

Co-authored-by: Cody Maloney <[email protected]>
Co-authored-by: Daniel Hillier <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
gpshead pushed a commit that referenced this pull request Nov 3, 2024
@miss-islington @cmaloney
@danifus @blurb-it
[3.13] gh-113977, gh-120754: Remove unbounded reads from zipfile (GH-…
7435127
…122101) (#126348)

gh-113977, gh-120754: Remove unbounded reads from zipfile (GH-122101)

GH-113977, GH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

(cherry picked from commit 556dc9b)

Co-authored-by: Cody Maloney <[email protected]>
Co-authored-by: Daniel Hillier <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
picnixz pushed a commit to picnixz/cpython that referenced this pull request Dec 8, 2024
@cmaloney @danifus
@blurb-it @picnixz
pythongh-113977, pythongh-120754: Remove unbounded reads from zipfile (…
b7046ab
…pythonGH-122101)

pythonGH-113977, pythonGH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

Co-authored-by: Daniel Hillier <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
@cmaloney @danifus
@blurb-it @ebonnal
pythongh-113977, pythongh-120754: Remove unbounded reads from zipfile (…
22db78f
…pythonGH-122101)

pythonGH-113977, pythonGH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

Co-authored-by: Daniel Hillier <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request May 9, 2026
Support xmind parse wecode-ai/Wegent#1064
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@gpshead gpshead gpshead approved these changes
+1 more reviewer
@danifus danifus danifus approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@cmaloney @picnixz @gpshead @danifus
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.