dxr3plugin fix to prevent segv for some corrupt streams
Commit Message
I tracked down a small problem in the dxr3pesframes code which was
causing a segv to occur while trying to play some corrupted streams.
dxr3pesframe.c contains the following loop which is used to find the
start of the first pes header:
for (; pos + 9 < length && !IsPesHeader(pesArray.SubArray(pos, 4));
pos++);
With corrupted streams loop may reach the end of the buffer without
finding a valid header and the subsequent code tries to decode the bogus
header data often causing a segv. The patch detects this condition and
causes the bad data to be dropped.
Jon
@@ -44,6 +44,10 @@
if (length > 9)
{
for (; pos + 9 < length && !IsPesHeader(pesArray.SubArray(pos, 4)); pos++);
+ if (pos + 9 >= length) {
+ m_remainingLength = 0;
+ return m_bValid;
+ }
m_pPesStart = pBuf + pos;
if ((pesArray[pos + 6] & 0xC0) == 0x80