Fix infinite loop when blockSize = 0 (#442)

A situation can occur where tsMuxer tries to extract data from a block which is not a PG track, and blocksize = 0 results in an infinite loop.

Fixes #440.
This commit is contained in:
jcdr428 2021-06-09 17:54:11 +01:00 committed by GitHub
parent 8028fb8449
commit a80cd66b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -364,10 +364,12 @@ void ParsedPGTrackData::extractData(AVPacket* pkt, uint8_t* buff, int size)
while (curPtr <= end - 3)
{
uint16_t blockSize = AV_RB16(curPtr + 1) + 3;
if (blockSize == 0)
break;
curPtr += blockSize;
blocks++;
}
assert(curPtr == end);
// assert(curPtr == end);
if (curPtr != end)
{
pkt->size = 0;