Skip to content

Commit

Permalink
Fix possible overflow in ReadBuf::release
Browse files Browse the repository at this point in the history
The addition to the tail can overflow, but we can safely wrap around.
  • Loading branch information
Thomasdezeeuw committed Aug 17, 2024
1 parent a519844 commit 79078cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/io/read_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ impl ReadBuf {
bid: buf_idx,
resv: 0,
});
ring_tail.store(tail + 1, Ordering::SeqCst);
ring_tail.store(tail.wrapping_add(1), Ordering::SeqCst);
drop(guard);
}
}
Expand Down

0 comments on commit 79078cb

Please sign in to comment.