changeset 21399:111bc7023189

ignore invalid values in the sequence display extension (backport from 0.4.1)
author henry
date Fri, 01 Dec 2006 17:47:55 +0000
parents 8234884ed8a7
children 6fe9c6a0c4b0
files libmpeg2/header.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpeg2/header.c	Fri Dec 01 17:30:49 2006 +0000
+++ b/libmpeg2/header.c	Fri Dec 01 17:47:55 2006 +0000
@@ -272,9 +272,11 @@
     if (!(buffer[2] & 2))	/* missing marker_bit */
 	return 1;
 
-    sequence->display_width = (buffer[1] << 6) | (buffer[2] >> 2);
-    sequence->display_height =
-	((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3);
+    if( (buffer[1] << 6) | (buffer[2] >> 2) )
+	sequence->display_width = (buffer[1] << 6) | (buffer[2] >> 2);
+    if( ((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3) )
+	sequence->display_height =
+	    ((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3);
 
     return 0;
 }