Skip to content

Commit

Permalink
[crash] Avoid debug-only left-shift overflow on corrupt input
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
emk committed Mar 5, 2017
1 parent 20e4301 commit 5d3364b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vobsub/src/mpeg2/ps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ named!(pub header<Header>,
take_bits!(u8, 5) >>
// Number of bytes of stuffing.
stuffing_length: take_bits!(usize, 3) >>
// Stuffing bytes.
take_bits!(u32, stuffing_length * 8) >>
// Stuffing bytes. We just want to ignore these, but use a
// large enough type to prevent overflow panics when
// fuzzing.
take_bits!(u64, stuffing_length * 8) >>
(Header {
scr: scr,
bit_rate: bit_rate,
Expand Down

0 comments on commit 5d3364b

Please sign in to comment.