]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-38256: Fix binascii.crc32() when inputs are 4+GiB (GH-32000)
authorGregory P. Smith <greg@krypto.org>
Sun, 20 Mar 2022 19:28:15 +0000 (12:28 -0700)
committerGitHub <noreply@github.com>
Sun, 20 Mar 2022 19:28:15 +0000 (12:28 -0700)
commit9d1c4d69dbc800ac344565119337fcf490cdc800
treef27ebdb3ae2bfa27853b42def2df6f29625ac5df
parent3ae975f1ac880c47d51cca6c9e305547bd365be7
bpo-38256: Fix binascii.crc32() when inputs are 4+GiB (GH-32000)

When compiled with `USE_ZLIB_CRC32` defined (`configure` sets this on POSIX systems), `binascii.crc32(...)` failed to compute the correct value when the input data was >= 4GiB. Because the zlib crc32 API is limited to a 32-bit length.

This lines it up with the `zlib.crc32(...)` implementation that doesn't have that flaw.

**Performance:** This also adopts the same GIL releasing for larger inputs logic that `zlib.crc32` has, and causes the Windows build to always use zlib's crc32 instead of our slow C code as zlib is a required build dependency on Windows.
Lib/test/test_binascii.py
Misc/NEWS.d/next/Library/2022-03-19-15-54-41.bpo-38256.FoMbjE.rst [new file with mode: 0644]
Modules/binascii.c
Modules/clinic/zlibmodule.c.h
Modules/zlibmodule.c
PCbuild/pythoncore.vcxproj