summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscop <scop>2005-05-01 13:54:47 +0000
committerscop <scop>2005-05-01 13:54:47 +0000
commit46fb09c2b6523710949be56be7ccb7ab137ae4e8 (patch)
treeb4f6d707b7aee87404784a4b7c3b8c3ca0319cdf
parentc4a283f663bd94cd83171a283454c42c378042ea (diff)
downloadvdr-plugin-dxr3-46fb09c2b6523710949be56be7ccb7ab137ae4e8.tar.gz
vdr-plugin-dxr3-46fb09c2b6523710949be56be7ccb7ab137ae4e8.tar.bz2
Corrupt stream fix from Jon Burgess, http://article.gmane.org/gmane.linux.vdr/21789
-rw-r--r--HISTORY1
-rw-r--r--dxr3pesframe.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/HISTORY b/HISTORY
index aea8b73..ca7aef4 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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*/)