mpegts: prevent get_bits64() from reading nonsense at the end.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-03-03 21:02:17 +01:00
parent d629f3edaa
commit 4a310a19de
1 changed files with 3 additions and 0 deletions

View File

@ -693,6 +693,9 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
static uint64_t get_bits64(GetBitContext *gb, int bits)
{
uint64_t ret = 0;
if (get_bits_left(gb) < bits)
return AV_NOPTS_VALUE;
while (bits > 17) {
ret <<= 17;
ret |= get_bits(gb, 17);