From e2e35b82738dc9d5e5229477d49d557cadad4dc7 Mon Sep 17 00:00:00 2001 From: Doug Benedict Date: Wed, 20 Sep 2017 14:30:42 -0700 Subject: Make sure there are enough bits when reading ADTS header. --- libMpegTPDec/src/tpdec_adts.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libMpegTPDec') diff --git a/libMpegTPDec/src/tpdec_adts.cpp b/libMpegTPDec/src/tpdec_adts.cpp index c455681..934fbc8 100644 --- a/libMpegTPDec/src/tpdec_adts.cpp +++ b/libMpegTPDec/src/tpdec_adts.cpp @@ -185,6 +185,9 @@ TRANSPORTDEC_ERROR adtsRead_DecodeHeader( #endif valBits = FDKgetValidBits(hBs); + if (valBits < ADTS_HEADERLENGTH) { + return TRANSPORTDEC_NOT_ENOUGH_BITS; + } /* adts_fixed_header */ bs.mpeg_id = FDKreadBits(hBs, Adts_Length_Id); -- cgit v1.2.3