amovie: avoid crash in amovie_request_frame() if no samplesref is available
authorStefano Sabatini <stefasab@gmail.com>
Sun, 13 Nov 2011 22:51:06 +0000 (23:51 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Mon, 14 Nov 2011 23:10:15 +0000 (00:10 +0100)
The crash occurrs when a frame is successfully decoded, but no decoded
data is immediately available (typically happens with ogg/vorbis).

libavfilter/src_movie.c

index 206099c..5806339 100644 (file)
@@ -446,8 +446,10 @@ static int amovie_request_frame(AVFilterLink *outlink)
 
     if (movie->is_done)
         return AVERROR_EOF;
-    if ((ret = amovie_get_samples(outlink)) < 0)
-        return ret;
+    do {
+        if ((ret = amovie_get_samples(outlink)) < 0)
+            return ret;
+    } while (!movie->samplesref);
 
     avfilter_filter_samples(outlink, avfilter_ref_buffer(movie->samplesref, ~0));
     avfilter_unref_buffer(movie->samplesref);