summaryrefslogtreecommitdiff
path: root/tools/pes.h
diff options
context:
space:
mode:
authorphintuka <phintuka>2006-08-18 02:17:24 +0000
committerphintuka <phintuka>2006-08-18 02:17:24 +0000
commitb6929ac95f1dcbbde0f67dc133480065d1e00485 (patch)
treeeecce9d460db0cd0fb56d2530ede7e21aca2b74b /tools/pes.h
parentb243517daec439b317fe34ee5db78915588ce15f (diff)
downloadxineliboutput-b6929ac95f1dcbbde0f67dc133480065d1e00485.tar.gz
xineliboutput-b6929ac95f1dcbbde0f67dc133480065d1e00485.tar.bz2
Fixed possible access to past of allocated memory (and conditional jump based on uninitialized data)
Diffstat (limited to 'tools/pes.h')
-rw-r--r--tools/pes.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/pes.h b/tools/pes.h
index c01b98db..af28c475 100644
--- a/tools/pes.h
+++ b/tools/pes.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: pes.h,v 1.1 2006-06-03 10:04:27 phintuka Exp $
+ * $Id: pes.h,v 1.2 2006-08-18 02:17:24 phintuka Exp $
*
*/
@@ -223,12 +223,11 @@ static inline int ScanVideoPacket(const uchar *Data, int Count, /*int Offset,*/
{
// Scans the video packet starting at Offset and returns its length.
// If the return value is -1 the packet was not completely in the buffer.
- int Offset = 0;
int Length = Count;
- if (Length > 0 && Offset + Length <= Count) {
- int i = Offset + 8; // the minimum length of the video packet header
+ if (Length > 0 && Length <= Count) {
+ int i = 8; // the minimum length of the video packet header
i += Data[i] + 1; // possible additional header bytes
- for (; i < Offset + Length; i++) {
+ for (; i < Length-5; i++) {
if (Data[i] == 0 && Data[i + 1] == 0 && Data[i + 2] == 1) {
switch (Data[i + 3]) {
case SC_PICTURE: