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 {
350350 })
351351 })
352352 .collect();
353- handles.into_iter().map(|h| h.join().expect("DV segment worker panicked")).collect()
354- });
353+ handles
354+ .into_iter()
355+ .map(|h| h.join().map_err(|_| Error::corrupt("DV: segment worker panicked")))
356+ .collect::<Result<Vec<Out>>>()
357+ })?;
355358 for o in &outs {
356359 o.apply(&mut planes);
357360 }
crates/ec-dvbsub/src/lib.rsmodified+6 -6
@@ -351,8 +351,8 @@ impl DvbSubDecoder {
351351 }
352352 let id = b[0];
353353 let fill = b[1] & 0x08 != 0;
354- let w = be16(b, 2).unwrap() as u32;
355- let h = be16(b, 4).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).ok_or_else(|| Error::corrupt("dvbsub: short region composition"))? as u32;
356356 if w == 0 || h == 0 || w > MAX_DIMENSION || h > MAX_DIMENSION {
357357 return Err(Error::corrupt("dvbsub: region size out of range"));
358358 }
@@ -375,10 +375,10 @@ impl DvbSubDecoder {
375375 let mut objects = Vec::new();
376376 let mut at = 10;
377377 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;
379379 let kind = b[at + 2] >> 6;
380- let x = (be16(b, at + 2).unwrap() & 0xFFF) as u32;
381- let y = (be16(b, at + 4).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).ok_or_else(|| Error::corrupt("dvbsub: short region object"))? & 0xFFF) as u32;
382382 objects.push((oid, x, y));
383383 at += if kind == 1 || kind == 2 { 8 } else { 6 };
384384 }
@@ -435,7 +435,7 @@ impl DvbSubDecoder {
435435 if b.len() < 3 {
436436 return Err(Error::corrupt("dvbsub: short object"));
437437 }
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;
439439 let method = (b[2] >> 2) & 3;
440440 if method != 0 {
441441 return Ok(()); // character-coded objects are not bitmaps