diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | dxr3pesframe.c | 6 |
2 files changed, 7 insertions, 0 deletions
@@ -292,3 +292,4 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 - set aspect ratio and audio mode to unknown when releasing devices, fixes the setup eg. after returning from the MPlayer plugin (Luca Olivetti, Kimmo Vuorinen) +- avoid crashing with some corrupted streams (Jon Burgess) diff --git a/dxr3pesframe.c b/dxr3pesframe.c index b32335d..2dd44f9 100644 --- a/dxr3pesframe.c +++ b/dxr3pesframe.c @@ -44,6 +44,12 @@ bool cDxr3PesFrame::ExtractNextFrame(const uint8_t* pBuf, uint32_t length) throw if (length > 9) { for (; pos + 9 < length && !IsPesHeader(pesArray.SubArray(pos, 4)); pos++); + if (pos + 9 >= length) + { + // Corrupt stream? + m_remainingLength = 0; + return m_bValid; + } m_pPesStart = pBuf + pos; if ((pesArray[pos + 6] & 0xC0) == 0x80 /*|| (pesArray[pos + 6] & 0xC0) == 0x00*/) |