It was not enough to set Cursor position to 0,
also its inner Vec should be cleared.
This way, a new input gets written at the beginning of the
Cursor and its inner Vec...
Ticket: #5691
(cherry picked from commit
086b28da3d06b269ba23ff0fa3c99419ce2f4d6a)
pub fn set_position(&mut self, pos: u64) {
return self.cursor.set_position(pos);
}
+
+ pub fn clear(&mut self) {
+ self.cursor.get_mut().clear();
+ self.cursor.set_position(0);
+ }
}
// we need to implement this as flate2 and brotli crates
}
}
//brotli does not consume all input if it reaches some end
-
- decoder.get_mut().set_position(0);
+ decoder.get_mut().clear();
return Ok(&output[..offset]);
}