forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'simplify/b14' into simplify/w1a

Browse files at this commit

f57a9d0ebc0eff961c586afca2379a81575103dbAhmet Kaan GümüşParent: b060602449ea58
crates/ec-dv/src/video.rsmodified+5 -2
@@ -350,8 +350,11 @@ impl DvVideoDecoder {
350 })350 })
351 })351 })
352 .collect();352 .collect();
353- handles.into_iter().map(|h| h.join().expect("DV segment worker panicked")).collect()353+ handles
354- });354+ .into_iter()
355+ .map(|h| h.join().map_err(|_| Error::corrupt("DV: segment worker panicked")))
356+ .collect::<Result<Vec<Out>>>()
357+ })?;
355 for o in &outs {358 for o in &outs {
356 o.apply(&mut planes);359 o.apply(&mut planes);
357 }360 }
crates/ec-dvbsub/src/lib.rsmodified+6 -6
@@ -351,8 +351,8 @@ impl DvbSubDecoder {
351 }351 }
352 let id = b[0];352 let id = b[0];
353 let fill = b[1] & 0x08 != 0;353 let fill = b[1] & 0x08 != 0;
354- let w = be16(b, 2).unwrap() as u32;354+ let w = be16(b, 2).ok_or_else(|| Error::corrupt("dvbsub: short region composition"))? as u32;
355- let h = be16(b, 4).unwrap() as u32;355+ let h = be16(b, 4).ok_or_else(|| Error::corrupt("dvbsub: short region composition"))? as u32;
356 if w == 0 || h == 0 || w > MAX_DIMENSION || h > MAX_DIMENSION {356 if w == 0 || h == 0 || w > MAX_DIMENSION || h > MAX_DIMENSION {
357 return Err(Error::corrupt("dvbsub: region size out of range"));357 return Err(Error::corrupt("dvbsub: region size out of range"));
358 }358 }
@@ -375,10 +375,10 @@ impl DvbSubDecoder {
375 let mut objects = Vec::new();375 let mut objects = Vec::new();
376 let mut at = 10;376 let mut at = 10;
377 while at + 6 <= b.len() {377 while at + 6 <= b.len() {
378- let oid = be16(b, at).unwrap() as u16;378+ let oid = be16(b, at).ok_or_else(|| Error::corrupt("dvbsub: short region object"))? as u16;
379 let kind = b[at + 2] >> 6;379 let kind = b[at + 2] >> 6;
380- let x = (be16(b, at + 2).unwrap() & 0xFFF) as u32;380+ let x = (be16(b, at + 2).ok_or_else(|| Error::corrupt("dvbsub: short region object"))? & 0xFFF) as u32;
381- let y = (be16(b, at + 4).unwrap() & 0xFFF) as u32;381+ let y = (be16(b, at + 4).ok_or_else(|| Error::corrupt("dvbsub: short region object"))? & 0xFFF) as u32;
382 objects.push((oid, x, y));382 objects.push((oid, x, y));
383 at += if kind == 1 || kind == 2 { 8 } else { 6 };383 at += if kind == 1 || kind == 2 { 8 } else { 6 };
384 }384 }
@@ -435,7 +435,7 @@ impl DvbSubDecoder {
435 if b.len() < 3 {435 if b.len() < 3 {
436 return Err(Error::corrupt("dvbsub: short object"));436 return Err(Error::corrupt("dvbsub: short object"));
437 }437 }
438- let oid = be16(b, 0).unwrap() as u16;438+ let oid = be16(b, 0).ok_or_else(|| Error::corrupt("dvbsub: short object"))? as u16;
439 let method = (b[2] >> 2) & 3;439 let method = (b[2] >> 2) & 3;
440 if method != 0 {440 if method != 0 {
441 return Ok(()); // character-coded objects are not bitmaps441 return Ok(()); // character-coded objects are not bitmaps