avcodec/ffv1dec: Explicitly check read_quant_table() return value
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 26 Sep 2015 11:09:59 +0000 (13:09 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 6 Dec 2015 11:40:49 +0000 (12:40 +0100)
Forwards the error code, avoids potential integer overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 10bbf6cf622f8a954c6cc694ca07c24f989c99af)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ffv1dec.c

index 26ed2ee..475b1ad 100644 (file)
@@ -503,7 +503,10 @@ static int read_quant_tables(RangeCoder *c,
     int context_count = 1;
 
     for (i = 0; i < 5; i++) {
-        context_count *= read_quant_table(c, quant_table[i], context_count);
+        int ret = read_quant_table(c, quant_table[i], context_count);
+        if (ret < 0)
+            return ret;
+        context_count *= ret;
         if (context_count > 32768U) {
             return AVERROR_INVALIDDATA;
         }