]> granicus.if.org Git - libvpx/commitdiff
Convert to int before adding negative numbers
authorYaowu Xu <yaowu@google.com>
Fri, 20 May 2016 14:55:08 +0000 (07:55 -0700)
committerYaowu Xu <yaowu@google.com>
Fri, 9 Sep 2016 19:43:02 +0000 (12:43 -0700)
This is avoid that -1 overflows uint32_t.

cherry-picked #c48106da from aom/master

Change-Id: Ic3d99b1985cdb0a28cc83f8291422f5aba5a5a6d

av1/encoder/lookahead.c

index d005438778d8e8d1692e4044b9fe677712e145a3..f5a0aa5a9b1f33db78c16651785ab13cf279b7e3 100644 (file)
@@ -213,8 +213,8 @@ struct lookahead_entry *av1_lookahead_peek(struct lookahead_ctx *ctx,
   } else if (index < 0) {
     // Backward peek
     if (-index <= MAX_PRE_FRAMES) {
-      index += ctx->read_idx;
-      if (index < 0) index += ctx->max_sz;
+      index += (int)(ctx->read_idx);
+      if (index < 0) index += (int)(ctx->max_sz);
       buf = ctx->buf + index;
     }
   }