forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'simplify/b3' into simplify/w1a

Browse files at this commit

04c5f323eafd9b7e6949b5e876e35c144b5d1d8aAhmet Kaan GümüşParent: 5248f508e80cd7
crates/ec-h264/src/codec.rsmodified+7 -4
@@ -105,8 +105,7 @@ impl H264Decoder {
105105 fn decode_packet_payload(&mut self, data: &[u8]) -> Result<()> {
106106 let Some(size) = self.nal_length_size else {
107107 for unit in AnnexBIter::new(data) {
108- let unit = unit.to_vec();
109- self.push(&unit)?;
108+ self.push(unit)?;
110109 }
111110 return Ok(());
112111 };
@@ -125,10 +124,14 @@ impl H264Decoder {
125124 "H.264: a NAL unit of {length} bytes overruns the packet"
126125 ))
127126 })?;
128- let unit = data[offset..end].to_vec();
129- self.push(&unit)?;
127+ self.push(&data[offset..end])?;
130128 offset = end;
131129 }
130+ if offset != data.len() {
131+ return Err(Error::corrupt(
132+ "H.264: trailing bytes too short for a NAL length field",
133+ ));
134+ }
132135 Ok(())
133136 }
134137