changeset 5792:aa620757cceb libavcodec

10l, check 'i' validity before using it
author bcoudurier
date Mon, 08 Oct 2007 12:11:19 +0000
parents 562c3853f8dc
children 33c615713e26
files dnxhddec.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dnxhddec.c	Mon Oct 08 12:08:42 2007 +0000
+++ b/dnxhddec.c	Mon Oct 08 12:11:19 2007 +0000
@@ -189,6 +189,11 @@
             i += ctx->cid_table->run[index2];
         }
 
+        if (i > 63) {
+            av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
+            return;
+        }
+
         j = ctx->scantable.permutated[i];
         //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j);
         //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weigth %d\n", level, weigth_matrix[i]);
@@ -197,12 +202,6 @@
             level += 32;
         level >>= 6;
         level = (level^sign) - sign;
-
-        if (i > 63) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
-            return;
-        }
-
         //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level);
         block[j] = level;
     }