forge
Explore
Log in

Don't you dare go Hollow

B15: ec-pcm-ext send_packet while a frame is pending returns NeedMore instead of dropping it

Browse files at this commit

a7e1cd197be7be4e1499d0e4988e77fdf585d697Ahmet Kaan GümüşParent: 22f0f3f
Evidence: send_packet overwrote self.pending, silently losing the prior frame.
Caller must receive_frame until NeedMore before submitting (registry contract).
Output unchanged for all valid call sequences.
crates/ec-pcm-ext/src/lib.rsmodified+3 -0
@@ -344,6 +344,9 @@ impl Decoder for PcmExtDecoder {
344 }344 }
345 345
346 fn send_packet(&mut self, packet: &Packet) -> Result<()> {346 fn send_packet(&mut self, packet: &Packet) -> Result<()> {
347+ if self.pending.is_some() {
348+ return Err(Error::NeedMore);
349+ }
347 self.decode(&packet.data)?;350 self.decode(&packet.data)?;
348 let channels = self.channels;351 let channels = self.channels;
349 let mut bytes = Vec::with_capacity(self.out.len() * 2);352 let mut bytes = Vec::with_capacity(self.out.len() * 2);