changeset 1727:0d0826c53aec libavformat

add sanity checks
author bcoudurier
date Wed, 24 Jan 2007 10:44:24 +0000
parents 63bb140936c0
children 5ed25b8bf482
files mov.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mov.c	Tue Jan 23 21:47:32 2007 +0000
+++ b/mov.c	Wed Jan 24 10:44:24 2007 +0000
@@ -1619,7 +1619,12 @@
 
     for(i=0; i<mov->total_streams; i++) {
         MOVStreamContext *sc = mov->streams[i];
-
+        /* sanity checks */
+        if(!sc->stts_count || !sc->chunk_count || !sc->sample_to_chunk_sz ||
+           (!sc->sample_size && !sc->sample_count)){
+            av_log(s, AV_LOG_ERROR, "missing mandatory atoms, broken header\n");
+            return -1;
+        }
         if(!sc->time_rate)
             sc->time_rate=1;
         if(!sc->time_scale)