Commit c48106da authored by Yaowu Xu's avatar Yaowu Xu

Convert to int before adding negative numbers

This is avoid that -1 overflows uint32_t.

Change-Id: Ic3d99b1985cdb0a28cc83f8291422f5aba5a5a6d
parent 000098a0
......@@ -214,8 +214,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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment