Skip to content

ChunkerParams: reject buzhash params that do not fit the chunker buffer - #10597

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:chunker-params-buffer-master
Nov 5, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:chunker-params-buffer-master

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Invalid buzhash chunker params, for example 10,12,11,4095, passed argument validation. They then crashed the buzhash Chunker with AssertionError: too small max_size (see the assertion in chunkers/buzhash.pyx).

The buzhash64 params branch already rejects such params, using window_size + 2^chunk_min + 1 <= 2^chunk_max. This PR applies the same check to the plain buzhash branch, including the old-style 4-number compat form. Such params now give a normal argument error (rc 2):

error: argument --chunker-params: required: window_size + 2^chunk_min + 1 <= 2^chunk_max

These params always crashed, so no working setup gets rejected. Tests cover two rejected cases and the exact boundary 10,13,11,4095, which is still accepted.

1.4-maint backport: #10596

🤖 Generated with Claude Code

Params like 10,12,11,4095 passed argument validation, but then crashed
the buzhash Chunker with "AssertionError: too small max_size".

Apply the same window_size + 2^chunk_min + 1 <= 2^chunk_max check that
buzhash64 already has, so this is a normal argument error now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.37%. Comparing base (184cae0) to head (d21017e).
⚠️ Report is 8 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10597      +/-   ##
==========================================
+ Coverage   89.35%   89.37%   +0.01%     
==========================================
  Files         104      105       +1     
  Lines       20091    20335     +244     
  Branches     3154     3192      +38     
==========================================
+ Hits        17953    18175     +222     
- Misses       1481     1501      +20     
- Partials      657      659       +2     

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

@ThomasWaldmann
ThomasWaldmann merged commit 880d5c0 into borgbackup:master Nov 5, 2026
25 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the chunker-params-buffer-master branch November 5, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant