Sample-Id: 00000262-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: [email protected]
---
 libavcodec/indeo4.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c
index 3c749a9..b99c08e 100644
--- a/libavcodec/indeo4.c
+++ b/libavcodec/indeo4.c
@@ -370,15 +370,6 @@ static int decode_band_hdr(IVI45DecContext *ctx, 
IVIBandDesc *band,
             band->scan = scan_index_to_tab[scan_indx];
 
             band->quant_mat = get_bits(&ctx->gb, 5);
-            if (band->quant_mat == 31) {
-                av_log(avctx, AV_LOG_ERROR, "Custom quant matrix 
encountered!\n");
-                return AVERROR_INVALIDDATA;
-            }
-            if (band->quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) {
-                avpriv_request_sample(avctx, "Quantization matrix %d",
-                                      band->quant_mat);
-                return AVERROR_INVALIDDATA;
-            }
         } else {
             if (old_blk_size != band->blk_size) {
                 av_log(avctx, AV_LOG_ERROR,
@@ -416,6 +407,16 @@ static int decode_band_hdr(IVI45DecContext *ctx, 
IVIBandDesc *band,
     }
 
     if (band->blk_size == 8) {
+        if (band->quant_mat == 31) {
+            av_log(avctx, AV_LOG_ERROR, "Custom quant matrix encountered!\n");
+            return AVERROR_INVALIDDATA;
+        }
+
+        if (band->quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) {
+            avpriv_request_sample(avctx, "Quantization matrix %d",
+                                  band->quant_mat);
+            return AVERROR_INVALIDDATA;
+        }
         band->intra_base = 
&ivi4_quant_8x8_intra[quant_index_to_tab[band->quant_mat]][0];
         band->inter_base = 
&ivi4_quant_8x8_inter[quant_index_to_tab[band->quant_mat]][0];
     } else {
-- 
1.8.3.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to