Commit c8ab0bcd authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Avoid out of bound read

BLOCK_Z_TOKEN is defined "255", this commit change the order of operations
to avoid read  av1_extra_bits[255]. av1_extra_bits is defined with size of

Change-Id: I59c35136bb064391139579bce591d1963e722611
parent 4330e1bd
......@@ -856,13 +856,13 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
while (p < stop && p->token != EOSB_TOKEN) {
const int token = p->token;
const av1_extra_bit *const extra_bits = &av1_extra_bits[token];
if (token == BLOCK_Z_TOKEN) {
aom_write_symbol(w, 0, *p->head_cdf, HEAD_TOKENS + 1);
const av1_extra_bit *const extra_bits = &av1_extra_bits[token];
if (p->eob_val == LAST_EOB) {
// Just code a flag indicating whether the value is >1 or 1.
aom_write_bit(w, token != ONE_TOKEN);
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