Commit 0a86a7d2 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Fix mem corruption due to undersized token buffer

Take a margin of 8 tokens.

BUG=aomedia:647

Change-Id: I04638a73deee334aa1f083f67c602c8a18cb951c
parent 9af0cf3c
......@@ -711,8 +711,10 @@ static INLINE int enc_is_ref_frame_buf(AV1_COMP *cpi, RefCntBuffer *frame_buf) {
static INLINE unsigned int get_token_alloc(int mb_rows, int mb_cols) {
// We assume 3 planes all at full resolution. We assume up to 1 token per
// pixel, and then allow a head room of 1 EOSB token per 4x4 block per plane,
// plus EOSB_TOKEN per plane.
return mb_rows * mb_cols * (16 * 16 + 17) * 3;
// plus EOSB_TOKEN per plane, plus a 8 token margin.
// TODO(sebastien): Figure out the exact max size needed.
// See: https://crbug.com/aomedia/647
return mb_rows * mb_cols * (16 * 16 + 17 + 8) * 3;
}
// Get the allocated token size for a tile. It does the same calculation as in
......
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