trifectatechfoundation / zlib-rs

A safer zlib
zlib License
139 stars 15 forks source link

fix panic in crc32 hash calc #222

Closed folkertdev closed 1 month ago

folkertdev commented 1 month ago

fixes https://github.com/trifectatechfoundation/zlib-rs/issues/219

The logic attempted to incorporate uninitialized bytes into the hash. That panics because of bounds checking, and we now handle it properly by having an upper bound to the slice index.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 76.19048% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
test-libz-rs-sys/src/deflate.rs 77.77% 22 Missing :warning:
zlib-rs/src/deflate/hash_calc.rs 50.00% 3 Missing :warning:
Files with missing lines Coverage Δ
zlib-rs/src/deflate/hash_calc.rs 80.71% <50.00%> (-1.30%) :arrow_down:
test-libz-rs-sys/src/deflate.rs 98.16% <77.77%> (-1.06%) :arrow_down: