We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d257d09 commit 141d008Copy full SHA for 141d008
1 file changed
vortex-buffer/src/bit/buf_mut.rs
@@ -376,7 +376,8 @@ impl BitBufferMut {
376
return;
377
}
378
379
- let end_bit = self.offset + len;
+ let end_bit = self.offset.checked_add(len)
380
+ .expect("BitBufferMut::truncate: offset + len overflow");
381
let new_len_bytes = end_bit.div_ceil(8);
382
self.buffer.truncate(new_len_bytes);
383
self.len = len;
@@ -442,7 +443,9 @@ impl BitBufferMut {
442
443
444
445
- let end_bit_pos = self.offset + self.len + n;
446
+ let end_bit_pos = self.offset.checked_add(self.len)
447
+ .and_then(|v| v.checked_add(n))
448
+ .expect("BitBufferMut::append_n: offset + len + n overflow");
449
let required_bytes = end_bit_pos.div_ceil(8);
450
451
// Ensure buffer has enough bytes
0 commit comments