Skip to content

Commit

Permalink
Avoid using default in HashBuffers::reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Mar 1, 2024
1 parent 79307d7 commit 5e8c3df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion miniz_oxide/src/deflate/buffer.rs
Expand Up @@ -31,7 +31,10 @@ pub struct HashBuffers {
impl HashBuffers {
#[inline]
pub fn reset(&mut self) {
*self = HashBuffers::default();
// Avoid `*self = default()` to prevent potential stack overflows.
self.dict.fill(0);
self.next.fill(0);
self.hash.fill(0);
}
}

Expand Down

0 comments on commit 5e8c3df

Please sign in to comment.