Fix integer overflow in compression_store.rs data retrieval logic
Issue
nativelink-store/src/compression_store.rs had an integer overflow issue during data retrieval. On line 526, the code was calculating an end position by adding start_pos + remaining_bytes_to_send as usize, which could overflow when remaining_bytes_to_send was very large. When this overflow occurred, it would cause end_pos to wrap around to a smaller value, potentially making it smaller than start_pos in the slice operation, triggering an "attempt to add with overflow" panic.
Fix
Changed the standard addition operation to use Rust's saturating addition:
// Before
let end_pos = start_pos + remaining_bytes_to_send as usize;
// After
let end_pos = start_pos.saturating_add(remaining_bytes_to_send as usize);
This prevents integer overflow by capping the result at the maximum possible value for the type instead of wrapping around.
Testing
All tests now pass, including the previously failing regression test that demonstrated this issue.
Related Issues
Fixes #1566