mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Fix overflowed arithmetic.
This uses wrapping_add, which was always the intended operation. Fixes #5275.
This commit is contained in:
parent
34950418ea
commit
331c7030d9
1 changed files with 1 additions and 1 deletions
|
@ -391,7 +391,7 @@ impl<T: Send> Buffer<T> {
|
|||
// NB: not entirely obvious, but thanks to 2's complement,
|
||||
// casting delta to usize and then adding gives the desired
|
||||
// effect.
|
||||
let buf = Buffer::new(self.log_size + delta as usize);
|
||||
let buf = Buffer::new(self.log_size.wrapping_add(delta as usize));
|
||||
for i in range(t, b) {
|
||||
buf.put(i, self.get(i));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue