Skip to content

Chorba: Fix edge case bug for >256KB input#2033

Merged
Dead2 merged 2 commits intozlib-ng:developfrom
samrussell:chorba_fix_edge_case
Dec 2, 2025
Merged

Chorba: Fix edge case bug for >256KB input#2033
Dead2 merged 2 commits intozlib-ng:developfrom
samrussell:chorba_fix_edge_case

Conversation

@samrussell
Copy link
Copy Markdown
Contributor

Fixes #2029

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 2, 2025

Walkthrough

Extended the Chorba CRC-32 bitbuffer initialization loop from 60 to 64 entries and increased CRC32 test buffer sizes and test coverage (larger BUFSIZE and many additional large-length test cases). No public API/declaration changes.

Changes

Cohort / File(s) Summary
Chorba bitbuffer initialization
arch/generic/crc32_chorba_c.c
Increased the initial bitbuffer zeroing loop from 60 iterations to 64 iterations (expanded indexed range).
CRC32 test vector and buffer size updates
test/crc32_test_strings_p.h, test/test_crc32_fold_copy.cc
Increased test buffer sizes (from 32,768 / 33,792 to 615,336) and added numerous large-length CRC32 test cases; updated BUFSIZE and related initialization/assertions.

Possibly related PRs

Suggested reviewers

  • Dead2
  • nmoinvaz

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing an edge case bug for large inputs (>256KB) in the Chorba CRC32 algorithm.
Description check ✅ Passed The description references issue #2029, which is directly related to the changeset. The issue documents a CRC-32 calculation failure that the PR aims to fix.
Linked Issues check ✅ Passed The PR makes targeted fixes to the Chorba CRC32 implementation (bitbuffer loop extension, buffer size increases) to address the edge case bug for large inputs reported in issue #2029.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the Chorba CRC32 algorithm for large inputs: extending the bitbuffer initialization loop and increasing test buffer sizes accordingly. No unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
arch/generic/crc32_chorba_c.c (1)

392-394: Zeroing 64 tail words matches pipeline depth; consider de‑duplicating magic constants

Extending the zeroing loop to cover 14870 .. 14870 + 64 aligns the cleared region with the (14870 + 64) look‑ahead used in the main pass condition at Line 270, which should eliminate the stale bitbuffer state that caused CRC mismatches on large inputs. The index math stays well within bitbuffersizezwords and is safely wrapped with % bitbuffersizezwords, so there’s no new bounds or UB concern here.

To avoid future off‑by‑N drift between these related constants, consider introducing named constants and reusing them in both places, e.g.:

-#define bitbuffersizeqwords (bitbuffersizebytes / sizeof(uint64_t))
+static const int chorba_118960_tail_base = 14870;
+static const int chorba_118960_tail_words = 64;
+#define bitbuffersizeqwords (bitbuffersizebytes / sizeof(uint64_t))
...
-    for(; (i + (14870 + 64) * sizeof(z_word_t)) < len; i += (32 * sizeof(z_word_t))) {
+    for(; (i + (chorba_118960_tail_base + chorba_118960_tail_words) * sizeof(z_word_t)) < len; i += (32 * sizeof(z_word_t))) {
...
-    for (int j = 14870; j < 14870 + 64; j++) {
-        bitbuffer[(j + (i / sizeof(z_word_t))) % bitbuffersizezwords] = 0;
-    }
+    for (int j = chorba_118960_tail_base;
+         j < chorba_118960_tail_base + chorba_118960_tail_words;
+         j++) {
+        bitbuffer[(j + (i / sizeof(z_word_t))) % bitbuffersizezwords] = 0;
+    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 066cc57 and cf5f18f.

📒 Files selected for processing (1)
  • arch/generic/crc32_chorba_c.c (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:0-0
Timestamp: 2025-02-23T16:49:52.043Z
Learning: In zlib-ng, bounds checking for CRC32 computation is handled by the caller, not within the individual CRC32 implementation functions like `crc32_chorba_sse2`.
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:0-0
Timestamp: 2025-02-21T01:42:40.488Z
Learning: In the SSE2-optimized Chorba CRC implementation (chorba_small_nondestructive_sse), the input buffer length is enforced to be a multiple of 16 bytes due to SSE2 operations, making additional checks for smaller alignments (like 8 bytes) redundant.
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:14-24
Timestamp: 2025-02-21T01:41:50.358Z
Learning: In zlib-ng's SSE2 vectorized Chorba CRC implementation, the code that calls READ_NEXT macro ensures 16-byte alignment, making explicit alignment checks unnecessary within the macro.
Learnt from: Dead2
Repo: zlib-ng/zlib-ng PR: 1837
File: arch/generic/crc32_c.c:19-29
Timestamp: 2025-01-23T22:01:53.422Z
Learning: The Chorba CRC32 functions (crc32_chorba_118960_nondestructive, crc32_chorba_32768_nondestructive, crc32_chorba_small_nondestructive, crc32_chorba_small_nondestructive_32bit) are declared in crc32_c.h.
Learnt from: samrussell
Repo: zlib-ng/zlib-ng PR: 1837
File: arch/generic/crc32_braid_c.c:596-597
Timestamp: 2024-12-25T19:45:06.009Z
Learning: We should verify out-of-bounds pointer arithmetic in chorba_118960_nondestructive() and related loops where "input + i" is used, especially when len < expected block sizes.
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1833
File: test/test_crc32.cc:0-0
Timestamp: 2024-12-22T20:40:03.280Z
Learning: In the crc32_align test class (test/test_crc32.cc), the alignment offset parameter is always guaranteed to be non-negative because the test parameters are controlled and it never makes sense to have a negative offset.
📚 Learning: 2025-02-21T01:42:40.488Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:0-0
Timestamp: 2025-02-21T01:42:40.488Z
Learning: In the SSE2-optimized Chorba CRC implementation (chorba_small_nondestructive_sse), the input buffer length is enforced to be a multiple of 16 bytes due to SSE2 operations, making additional checks for smaller alignments (like 8 bytes) redundant.

Applied to files:

  • arch/generic/crc32_chorba_c.c
📚 Learning: 2025-01-23T22:01:53.422Z
Learnt from: Dead2
Repo: zlib-ng/zlib-ng PR: 1837
File: arch/generic/crc32_c.c:19-29
Timestamp: 2025-01-23T22:01:53.422Z
Learning: The Chorba CRC32 functions (crc32_chorba_118960_nondestructive, crc32_chorba_32768_nondestructive, crc32_chorba_small_nondestructive, crc32_chorba_small_nondestructive_32bit) are declared in crc32_c.h.

Applied to files:

  • arch/generic/crc32_chorba_c.c
📚 Learning: 2025-02-23T16:49:52.043Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:0-0
Timestamp: 2025-02-23T16:49:52.043Z
Learning: In zlib-ng, bounds checking for CRC32 computation is handled by the caller, not within the individual CRC32 implementation functions like `crc32_chorba_sse2`.

Applied to files:

  • arch/generic/crc32_chorba_c.c
📚 Learning: 2025-02-21T01:41:50.358Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:14-24
Timestamp: 2025-02-21T01:41:50.358Z
Learning: In zlib-ng's SSE2 vectorized Chorba CRC implementation, the code that calls READ_NEXT macro ensures 16-byte alignment, making explicit alignment checks unnecessary within the macro.

Applied to files:

  • arch/generic/crc32_chorba_c.c
📚 Learning: 2024-12-25T19:45:06.009Z
Learnt from: samrussell
Repo: zlib-ng/zlib-ng PR: 1837
File: arch/generic/crc32_braid_c.c:596-597
Timestamp: 2024-12-25T19:45:06.009Z
Learning: We should verify out-of-bounds pointer arithmetic in chorba_118960_nondestructive() and related loops where "input + i" is used, especially when len < expected block sizes.

Applied to files:

  • arch/generic/crc32_chorba_c.c
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (82)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC -O3 OSB add_subdirectory
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS Clang Native Instructions (Intel)
  • GitHub Check: Windows GCC Compat No Opt
  • GitHub Check: Windows MSVC 2022 v142 Win64
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: EL10 GCC S390X DFLTCC ASAN
  • GitHub Check: Ubuntu GCC AARCH64 No NEON UBSAN
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC -O3 OSB add_subdirectory
  • GitHub Check: macOS GCC (ARM64)

@Dead2 Dead2 added the bug label Dec 2, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.88%. Comparing base (066cc57) to head (b00ba30).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2033      +/-   ##
===========================================
- Coverage    80.90%   80.88%   -0.02%     
===========================================
  Files          163      163              
  Lines        12883    12883              
  Branches      3174     3174              
===========================================
- Hits         10423    10421       -2     
- Misses        1387     1423      +36     
+ Partials      1073     1039      -34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add test case from @KungFuJesus and a few others in similar data lengths
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/crc32_test_strings_p.h (1)

4-13: Avoid duplicating the buffer size literal in the init loop

You now hard-code 615336 both in the array size and the fill loop bound. To avoid future mismatches if this buffer grows again, consider driving the loop from sizeof(crc32_fullwin_buf) instead of a magic constant (and using an index type that matches it):

-ALIGNED_(16) static uint8_t crc32_fullwin_buf[615336];
-
-static uint8_t* crc32_setup_buf() {
-    for (int i = 0; i < 615336; ++i) {
+ALIGNED_(16) static uint8_t crc32_fullwin_buf[615336];
+
+static uint8_t* crc32_setup_buf() {
+    for (size_t i = 0; i < sizeof(crc32_fullwin_buf); ++i) {
         uint8_t ic = (uint8_t)(i % 256);
         crc32_fullwin_buf[i] = ic;
     }

This keeps the buffer length and init loop in lockstep with no extra maintenance.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf5f18f and b00ba30.

📒 Files selected for processing (2)
  • test/crc32_test_strings_p.h (2 hunks)
  • test/test_crc32_fold_copy.cc (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:0-0
Timestamp: 2025-02-23T16:49:52.043Z
Learning: In zlib-ng, bounds checking for CRC32 computation is handled by the caller, not within the individual CRC32 implementation functions like `crc32_chorba_sse2`.
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:0-0
Timestamp: 2025-02-21T01:42:40.488Z
Learning: In the SSE2-optimized Chorba CRC implementation (chorba_small_nondestructive_sse), the input buffer length is enforced to be a multiple of 16 bytes due to SSE2 operations, making additional checks for smaller alignments (like 8 bytes) redundant.
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:14-24
Timestamp: 2025-02-21T01:41:50.358Z
Learning: In zlib-ng's SSE2 vectorized Chorba CRC implementation, the code that calls READ_NEXT macro ensures 16-byte alignment, making explicit alignment checks unnecessary within the macro.
Learnt from: Dead2
Repo: zlib-ng/zlib-ng PR: 1837
File: arch/generic/crc32_c.c:19-29
Timestamp: 2025-01-23T22:01:53.422Z
Learning: The Chorba CRC32 functions (crc32_chorba_118960_nondestructive, crc32_chorba_32768_nondestructive, crc32_chorba_small_nondestructive, crc32_chorba_small_nondestructive_32bit) are declared in crc32_c.h.
Learnt from: samrussell
Repo: zlib-ng/zlib-ng PR: 1837
File: arch/generic/crc32_braid_c.c:596-597
Timestamp: 2024-12-25T19:45:06.009Z
Learning: We should verify out-of-bounds pointer arithmetic in chorba_118960_nondestructive() and related loops where "input + i" is used, especially when len < expected block sizes.
📚 Learning: 2025-02-21T01:42:40.488Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:0-0
Timestamp: 2025-02-21T01:42:40.488Z
Learning: In the SSE2-optimized Chorba CRC implementation (chorba_small_nondestructive_sse), the input buffer length is enforced to be a multiple of 16 bytes due to SSE2 operations, making additional checks for smaller alignments (like 8 bytes) redundant.

Applied to files:

  • test/crc32_test_strings_p.h
  • test/test_crc32_fold_copy.cc
📚 Learning: 2025-01-23T22:01:53.422Z
Learnt from: Dead2
Repo: zlib-ng/zlib-ng PR: 1837
File: arch/generic/crc32_c.c:19-29
Timestamp: 2025-01-23T22:01:53.422Z
Learning: The Chorba CRC32 functions (crc32_chorba_118960_nondestructive, crc32_chorba_32768_nondestructive, crc32_chorba_small_nondestructive, crc32_chorba_small_nondestructive_32bit) are declared in crc32_c.h.

Applied to files:

  • test/crc32_test_strings_p.h
📚 Learning: 2024-12-22T20:40:03.280Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1833
File: test/test_crc32.cc:0-0
Timestamp: 2024-12-22T20:40:03.280Z
Learning: In the crc32_align test class (test/test_crc32.cc), the alignment offset parameter is always guaranteed to be non-negative because the test parameters are controlled and it never makes sense to have a negative offset.

Applied to files:

  • test/crc32_test_strings_p.h
  • test/test_crc32_fold_copy.cc
📚 Learning: 2025-02-21T01:41:50.358Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/chorba_sse2.c:14-24
Timestamp: 2025-02-21T01:41:50.358Z
Learning: In zlib-ng's SSE2 vectorized Chorba CRC implementation, the code that calls READ_NEXT macro ensures 16-byte alignment, making explicit alignment checks unnecessary within the macro.

Applied to files:

  • test/crc32_test_strings_p.h
🧬 Code graph analysis (1)
test/test_crc32_fold_copy.cc (1)
test/benchmarks/benchmark_crc32_fold_copy.cc (7)
  • state (43-87)
  • crc32_fold_copy_chorba_sse41 (36-39)
  • crc32_fold_copy_chorba (23-26)
  • crc32_fold_copy_chorba_sse2 (30-33)
  • state (50-58)
  • state (83-86)
  • state (60-81)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (110)
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
  • GitHub Check: macOS GCC (ARM64)
  • GitHub Check: macOS GCC (Intel)
  • GitHub Check: Ubuntu GCC ARM HF
  • GitHub Check: macOS GCC UBSAN (ARM64)
  • GitHub Check: Windows GCC Native Instructions (AVX)
  • GitHub Check: Ubuntu MinGW i686
  • GitHub Check: macOS Clang ASAN (ARM64)
  • GitHub Check: Windows MSVC ARM64 No Test
  • GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
  • GitHub Check: EL10 GCC S390X DFLTCC UBSAN
  • GitHub Check: Windows MSVC 2022 v141 Win64
🔇 Additional comments (2)
test/test_crc32_fold_copy.cc (1)

15-28: BUFSIZE bump is consistent with new max test length

BUFSIZE = 615336U matches the largest len in crc32_tests (the 615336-byte buf32k case), and ASSERT_LE(params.len, BUFSIZE) continues to guarantee dstbuf is not overrun. This cleanly aligns the fold-copy tests with the expanded large-input coverage.

test/crc32_test_strings_p.h (1)

180-191: New large buf32k test vectors are well-bounded and target the edge case

The additional buf32k entries up to length 615336:

  • All use buf32k pointing into crc32_fullwin_buf[615336], so len never exceeds the backing buffer.
  • Stay within the updated BUFSIZE used by test_crc32_fold_copy (ASSERT_LE(params.len, BUFSIZE) still holds).
  • Cluster around large sizes (118960+512 and several values in the 6150xx–615336 range), which is exactly where the Chorba bitbuffer logic was problematic.

These look like solid coverage for the >256KB regression without introducing new OOB risks.

@nmoinvaz
Copy link
Copy Markdown
Member

nmoinvaz commented Dec 2, 2025

@Dead2 probably needs to be backported with a new release?

@Dead2 Dead2 merged commit af3de94 into zlib-ng:develop Dec 2, 2025
156 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants