From 2e23af940d5dae9ef56ba8ba0c745bf56c3545fd 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/src') diff --git a/libMpegTPDec/src/tpdec_adts.cpp b/libMpegTPDec/src/tpdec_adts.cpp index 6dc0275..d6fac21 100644 --- a/libMpegTPDec/src/tpdec_adts.cpp +++ b/libMpegTPDec/src/tpdec_adts.cpp @@ -181,6 +181,9 @@ TRANSPORTDEC_ERROR adtsRead_DecodeHeader(HANDLE_ADTS pAdts, FDKmemcpy(&oldPce, &pAsc->m_progrConfigElement, sizeof(CProgramConfig)); 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