Skip to content

_hashindex.c: more fixes#9575

Open
ThomasWaldmann wants to merge 1 commit intoborgbackup:1.4-maintfrom
ThomasWaldmann:hashindex-fixes-1.4
Open

_hashindex.c: more fixes#9575
ThomasWaldmann wants to merge 1 commit intoborgbackup:1.4-maintfrom
ThomasWaldmann:hashindex-fixes-1.4

Conversation

@ThomasWaldmann
Copy link
Copy Markdown
Member

  • avoid buckets_length integer overflow on 32bit systems via huge num_buckets
  • always initialize index-> min_empty and num_empty
  • correctly free memory when header validation fails. this is a minor issue, because borg will terminate in that case anyway.
  • make it possible to lookup in compacted hashtables
  • deal safely with empty index: we must use num_buckets = 1 to avoid division by zero and sanity check in hashindex_read.
  • reinitialize upper/lower limit and min_empty after compact
  • fix size_idx / fit_size / grow_size / shrink_size (mind array bounds)
  • deal with growing when already at max capacity
  • hashindex_resize: replace num_entries assertion, rather return error

- avoid buckets_length integer overflow on 32bit systems via huge num_buckets
- always initialize index-> min_empty and num_empty
- correctly free memory when header validation fails.
  this is a minor issue, because borg will terminate in that case anyway.
- make it possible to lookup in compacted hashtables
- deal safely with empty index: we must use num_buckets = 1 to avoid division
  by zero and sanity check in hashindex_read.
- reinitialize upper/lower limit and min_empty after compact
- fix size_idx / fit_size / grow_size / shrink_size (mind array bounds)
- deal with growing when already at max capacity
- hashindex_resize: replace num_entries assertion, rather return error
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.96%. Comparing base (7fd6df2) to head (eb11772).
⚠️ Report is 1 commits behind head on 1.4-maint.

Additional details and impacted files
@@              Coverage Diff              @@
##           1.4-maint    #9575      +/-   ##
=============================================
- Coverage      81.97%   81.96%   -0.01%     
=============================================
  Files             38       38              
  Lines          11299    11299              
  Branches        1778     1778              
=============================================
- Hits            9262     9261       -1     
- Misses          1452     1453       +1     
  Partials         585      585              

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

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