changeset 5327:a8e26981c104 libavformat

Fix infinite loop with size==0 && sample_size!=0 in non interleaved avis. Untested, i do not have a sample.
author michael
date Thu, 22 Oct 2009 18:43:08 +0000
parents 4e1e9ab777a1
children 2f2a94b37543
files avidec.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/avidec.c	Thu Oct 22 18:32:27 2009 +0000
+++ b/avidec.c	Thu Oct 22 18:43:08 2009 +0000
@@ -170,7 +170,7 @@
 
             if(last_pos == pos || pos == base - 8)
                 avi->non_interleaved= 1;
-            if(last_pos != pos)
+            if(last_pos != pos && (len || !ast->sample_size))
                 av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0);
 
             if(ast->sample_size)
@@ -905,7 +905,7 @@
                 ast->packet_size= size + 8;
                 ast->remaining= size;
 
-                {
+                if(size || !ast->sample_size){
                     uint64_t pos= url_ftell(pb) - 8;
                     if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
                         av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
@@ -964,7 +964,7 @@
 
         if(last_pos == pos)
             avi->non_interleaved= 1;
-        else
+        else if(len || !ast->sample_size)
             av_add_index_entry(st, pos, ast->cum_len, len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
         if(ast->sample_size)
             ast->cum_len += len;