Skip to content

Commit 5d3364b

Browse files
committed
[crash] Avoid debug-only left-shift overflow on corrupt input
This is only arguably a fuzzer trophy, because it only occurs if: 1. The input is corrupt, 2. AND we're compiled in debug mode. But better to fix it.
1 parent 20e4301 commit 5d3364b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vobsub/src/mpeg2/ps.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ named!(pub header<Header>,
4646
take_bits!(u8, 5) >>
4747
// Number of bytes of stuffing.
4848
stuffing_length: take_bits!(usize, 3) >>
49-
// Stuffing bytes.
50-
take_bits!(u32, stuffing_length * 8) >>
49+
// Stuffing bytes. We just want to ignore these, but use a
50+
// large enough type to prevent overflow panics when
51+
// fuzzing.
52+
take_bits!(u64, stuffing_length * 8) >>
5153
(Header {
5254
scr: scr,
5355
bit_rate: bit_rate,

0 commit comments

Comments
 (0)