Skip to content

zlib.crc32_combine() hangs on a negative length and adler32_combine() returns rubbish #156180

Description

@StanFromIreland

Bug report

Bug description:

From the manual:

adler32_combine: If len2 is negative, the result has no meaning or utility.

crc32_combine: len2 must be non-negative.

To reproduce run:

$ python3.15 -c "import zlib; zlib.crc32_combine(0, 0, -5)"

which hangs due to a loop in zlib. And,

$ python3.15 -c "import zlib; print(zlib.adler32_combine(0, 0, -5))"
4294967295

which is rubbish.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Labels

extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions