]> granicus.if.org Git - libvpx/commitdiff
svc_encodeframe: quiet -Warray-bounds warnings
authorJames Zern <jzern@google.com>
Sat, 15 Mar 2014 01:37:20 +0000 (18:37 -0700)
committerJames Zern <jzern@google.com>
Sat, 15 Mar 2014 01:37:20 +0000 (18:37 -0700)
si->layers is validated prior to assignment; add an assertion prior to
first use as a loop bound

Change-Id: I727d4e24be3c352c3e5320d92e89d3f787944812

vpx/src/svc_encodeframe.c

index 3e22fdf383e9b532f3f3fa92727dc2be51814fd2..4f3f7ec87a1b655d9a6e498ef6ea0304b5b6171a 100644 (file)
@@ -13,6 +13,7 @@
  * VP9 SVC encoding support via libvpx
  */
 
+#include <assert.h>
 #include <math.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -550,6 +551,7 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
     float total = 0;
     float alloc_ratio[VPX_SS_MAX_LAYERS] = {0};
 
+    assert(si->layers <= VPX_SS_MAX_LAYERS);
     for (i = 0; i < si->layers; ++i) {
       int pos = i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers;
       if (pos < VPX_SS_MAX_LAYERS && si->scaling_factor_den[pos] > 0) {