diff options
| author | Johns <johns98@gmx.net> | 2012-10-19 15:36:41 +0200 |
|---|---|---|
| committer | Johns <johns98@gmx.net> | 2012-10-19 15:36:41 +0200 |
| commit | 92b4203644593e595b34094b5acafeb37219fa41 (patch) | |
| tree | a6b944c1cceb18171b3d28ce4f19c48a352b72a5 /softhddev.c | |
| parent | f640ebdeb5d0af907be4016658ea2229847e39ba (diff) | |
| download | vdr-plugin-softhddevice-92b4203644593e595b34094b5acafeb37219fa41.tar.gz vdr-plugin-softhddevice-92b4203644593e595b34094b5acafeb37219fa41.tar.bz2 | |
Fix bug: possible endless loop in pes audio parser.
Diffstat (limited to 'softhddev.c')
| -rw-r--r-- | softhddev.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/softhddev.c b/softhddev.c index d2eee03..5b48fa8 100644 --- a/softhddev.c +++ b/softhddev.c @@ -718,13 +718,16 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size, // have header upto size bits if (pesdx->HeaderIndex == PES_HEADER_SIZE) { - if ((pesdx->Header[6] & 0xC0) == 0x80) { - pesdx->HeaderSize += pesdx->Header[8]; - } else { + if ((pesdx->Header[6] & 0xC0) != 0x80) { Error(_("pesdemux: mpeg1 pes packet unsupported\n")); pesdx->State = PES_SKIP; return; } + // have pes extension + if (!pesdx->Header[8]) { + goto empty_header; + } + pesdx->HeaderSize += pesdx->Header[8]; // have complete header } else if (pesdx->HeaderIndex == pesdx->HeaderSize) { int64_t pts; @@ -753,6 +756,7 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size, pts, dts); } + empty_header: pesdx->State = PES_INIT; if (pesdx->StartCode == PES_PRIVATE_STREAM1) { // only private stream 1, has sub streams |
