From: Kostya Shishkov Date: Sat, 4 Apr 2020 10:27:55 +0000 (+0200) Subject: codec_support/h263: validate that B-frame has enough reference data X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=df05c4383da3fc259763db9b905dff548e74e2be;p=nihav.git codec_support/h263: validate that B-frame has enough reference data --- diff --git a/nihav-codec-support/src/codecs/h263/decoder.rs b/nihav-codec-support/src/codecs/h263/decoder.rs index 7a88882..02d6075 100644 --- a/nihav-codec-support/src/codecs/h263/decoder.rs +++ b/nihav-codec-support/src/codecs/h263/decoder.rs @@ -213,6 +213,10 @@ impl H263BaseDecoder { } let is_b = pinfo.mode == Type::B; + if is_b && (self.mv_data.len() < self.mb_w * self.mb_h) { + return Err(DecoderError::MissingReference); + } + let tsdiff = if pinfo.is_pb() { pinfo.ts.wrapping_sub(self.last_ts) >> 1 } else { self.last_ts.wrapping_sub(self.next_ts) >> 1 }; let bsdiff = if pinfo.is_pb() { (pinfo.get_pbinfo().get_trb() as u16) << 7 }