Skip to content

[3.10] bpo-41486: zlib uses an UINT32_MAX sliding window for the output buffer (GH-26143)#27025

Merged
miss-islington merged 1 commit into
python:3.10from
miss-islington:backport-a9a69bb-3.10
Jul 5, 2021
Merged

[3.10] bpo-41486: zlib uses an UINT32_MAX sliding window for the output buffer (GH-26143)#27025
miss-islington merged 1 commit into
python:3.10from
miss-islington:backport-a9a69bb-3.10

Conversation

@miss-islington

@miss-islington miss-islington commented Jul 5, 2021

Copy link
Copy Markdown
Contributor
  • zlib uses an UINT32_MAX sliding window for the output buffer

These funtions have an initial output buffer size parameter:

  • zlib.decompress(data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)
  • zlib.Decompress.flush([length])

If the initial size > UINT32_MAX, use an UINT32_MAX sliding window, instead of clamping to UINT32_MAX.
Speed up when (the initial size == the actual size).

This fixes a memory consumption and copying performance regression in earlier 3.10 beta releases if someone used an output buffer larger than 4GiB with zlib.decompress.

Reviewed-by: Gregory P. Smith
(cherry picked from commit a9a69bb)

Co-authored-by: Ma Lin animalize@users.noreply.github.com

https://bugs.python.org/issue41486

Automerge-Triggered-By: GH:gpshead

…er (pythonGH-26143)

* zlib uses an UINT32_MAX sliding window for the output buffer

These funtions have an initial output buffer size parameter:
- zlib.decompress(data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)
- zlib.Decompress.flush([length])

If the initial size > UINT32_MAX, use an UINT32_MAX sliding window, instead of clamping to UINT32_MAX.
Speed up when (the initial size == the actual size).

This fixes a memory consumption and copying performance regression in earlier 3.10 beta releases if someone used an output buffer larger than 4GiB with zlib.decompress.

Reviewed-by: Gregory P. Smith
(cherry picked from commit a9a69bb)

Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
@miss-islington

Copy link
Copy Markdown
Contributor Author

@animalize and @gpshead: Status check is done, and it's a success ✅ .

@bedevere-bot bedevere-bot added type-bug An unexpected behavior, bug, or error performance Performance or resource usage awaiting review labels Jul 5, 2021
@miss-islington

Copy link
Copy Markdown
Contributor Author

@animalize and @gpshead: Status check is done, and it's a success ✅ .

@miss-islington
miss-islington merged commit 22bcc07 into python:3.10 Jul 5, 2021
@miss-islington
miss-islington deleted the backport-a9a69bb-3.10 branch July 5, 2021 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants