changeset 27110:f83be44e1faf

Do not use stdata before checking its length
author reimar
date Sun, 29 Jun 2008 07:25:47 +0000
parents 9440e551f9e3
children 4899f42d1c94
files libmpdemux/demux_mov.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c	Sat Jun 28 19:32:35 2008 +0000
+++ b/libmpdemux/demux_mov.c	Sun Jun 29 07:25:47 2008 +0000
@@ -928,10 +928,6 @@
 		int hdr_ptr = 76;  // the byte just after depth
 		unsigned char *palette_map;
 
-		depth = trak->stdata[75] | (trak->stdata[74] << 8);
-		if (trak->fourcc == mmioFOURCC('r', 'a', 'w', ' ')) {
-		    sh->format = IMGFMT_RGB | depth;
-		} else
 		    sh->format=trak->fourcc;
 
 		// crude video delay from editlist0 hack ::atm
@@ -949,6 +945,11 @@
 		  trak->stdata_len);
 		  return 0;
 		}
+
+		depth = trak->stdata[75] | (trak->stdata[74] << 8);
+		if (trak->fourcc == mmioFOURCC('r', 'a', 'w', ' '))
+		    sh->format = IMGFMT_RGB | depth;
+
 //  stdata[]:
 //	8   short	version
 //	10  short	revision