mov: reject zero bytes_per_frame with non-zero samples_per_frame
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Mon, 25 May 2015 15:17:39 +0000 (17:17 +0200)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Mon, 25 May 2015 22:28:02 +0000 (00:28 +0200)
In this case the mov demuxer can return a large number of empty packets.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/mov.c

index e32f7f436dcc9ebb2da5013da2435752413d931e..51cdd21abd3fc1286a4703ec65ca96a073a31d11 100644 (file)
@@ -2587,6 +2587,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
                 AVIndexEntry *e;
                 unsigned size, samples;
 
+                if (sc->samples_per_frame > 1 && !sc->bytes_per_frame) {
+                    avpriv_request_sample(mov->fc,
+                           "Zero bytes per frame, but %d samples per frame",
+                           sc->samples_per_frame);
+                    return;
+                }
+
                 if (sc->samples_per_frame >= 160) { // gsm
                     samples = sc->samples_per_frame;
                     size = sc->bytes_per_frame;