Skip to content

Commit 6da3934

Browse files
committed
isomp4: validate es descriptor length
1 parent 65f8077 commit 6da3934

File tree

1 file changed

+7
-0
lines changed
  • symphonia-format-isomp4/src/atoms

1 file changed

+7
-0
lines changed

symphonia-format-isomp4/src/atoms/esds.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ pub struct ESDescriptor {
243243

244244
impl ObjectDescriptor for ESDescriptor {
245245
fn read<B: ReadBytes>(reader: &mut B, len: u32) -> Result<Self> {
246+
let pos = reader.pos();
247+
246248
let es_id = reader.read_be_u16()?;
247249
let es_flags = reader.read_u8()?;
248250

@@ -265,6 +267,11 @@ impl ObjectDescriptor for ESDescriptor {
265267
let mut dec_config = None;
266268
let mut sl_config = None;
267269

270+
// len should be bigger than what have been read
271+
if reader.pos() - pos > len as u64 {
272+
return decode_error("isomp4: es descriptor len is wrong");
273+
}
274+
268275
let mut scoped = ScopedStream::new(reader, u64::from(len) - 3);
269276

270277
// Multiple descriptors follow, but only the decoder configuration descriptor is useful.

0 commit comments

Comments
 (0)