summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-05-05 14:59:46 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-05-05 14:59:46 +0200
commit1c62f19c8ca1f6b5f3551f1416b5ee34b548e4ed (patch)
tree221ee59d171736f300a73fa7ef279ad3bad7eea6
parentcfab3380c7cdedbd4dccd9ade156e0f58ec0ce30 (diff)
downloadvdr-1c62f19c8ca1f6b5f3551f1416b5ee34b548e4ed.tar.gz
vdr-1c62f19c8ca1f6b5f3551f1416b5ee34b548e4ed.tar.bz2
Fixed handling fragments of less than 3 byte in cPesAssembler
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--device.c10
3 files changed, 9 insertions, 4 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index d88f0d48..0277283d 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -938,6 +938,7 @@ Reinhard Nissl <rnissl@gmx.de>
for fixing a possible freeze in pause mode in case a device's PlayPesPacket()
function permanently returns 0
for fixing a typo in detecting UTF-8
+ for fixing handling fragments of less than 3 byte in cPesAssembler
Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the
diff --git a/HISTORY b/HISTORY
index 9fdad9c0..56f25e96 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3487,3 +3487,5 @@ Video Disk Recorder Revision History
- Fixed handling transparent areas in cDvbSpuBitmap (thanks to Marco Schlüßler).
- Now also considering the "EPG linger time" when saving the EPG data to file or
listing it via LSTE (thanks to Roman Krenický).
+- Fixed handling fragments of less than 3 byte in cPesAssembler (thanks to
+ Reinhard Nissl).
diff --git a/device.c b/device.c
index d6ab8911..83ce56d7 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.c 1.99 2005/02/27 13:55:15 kls Exp $
+ * $Id: device.c 1.100 2005/05/05 14:48:01 kls Exp $
*/
#include "device.h"
@@ -34,7 +34,7 @@ public:
int ExpectedLength(void) { return PacketSize(data); }
static int PacketSize(const uchar *data);
int Length(void) { return length; }
- const uchar *Data(void) { return data; }
+ const uchar *Data(void) { return data; } // only valid if Length() >= 4
void Reset(void);
void Put(uchar c);
void Put(const uchar *Data, int Length);
@@ -76,7 +76,7 @@ bool cPesAssembler::Realloc(int Size)
void cPesAssembler::Put(uchar c)
{
- if (!length) {
+ if (length < 4) {
tag = (tag << 8) | c;
if ((tag & 0xFFFFFF00) == 0x00000100) {
if (Realloc(4)) {
@@ -84,6 +84,8 @@ void cPesAssembler::Put(uchar c)
length = 4;
}
}
+ else if (length < 3)
+ length++;
}
else if (Realloc(length + 1))
data[length++] = c;
@@ -91,7 +93,7 @@ void cPesAssembler::Put(uchar c)
void cPesAssembler::Put(const uchar *Data, int Length)
{
- while (!length && Length > 0) {
+ while (length < 4 && Length > 0) {
Put(*Data++);
Length--;
}