Commit 415c8f1f authored by Rupert Swarbrick's avatar Rupert Swarbrick Committed by Debargha Mukherjee
Browse files

Catch invalid block sizes in bitstream

There's a bitstream conformance requirement that says that any block
must subsample to a valid block size with the current subsampling
mode. For example, this means that BLOCK_4X8 is illegal if there is
subsampling in only the horizontal direction (since there is no

This patch checks the bitstream is conformant as it reads partition
information in decodeframe.c


Change-Id: I18139aa76d6f965282402edbb0b68959478a46c3
parent ab8840eb
......@@ -2335,6 +2335,15 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
has_rows, has_cols, bsize);
subsize = subsize_lookup[partition][bsize]; // get_subsize(bsize, partition);
// Check the bitstream is conformant: if there is subsampling on the
// chroma planes, subsize must subsample to a valid block size.
const struct macroblockd_plane *const pd_u = &xd->plane[1];
if (get_plane_block_size(subsize, pd_u) == BLOCK_INVALID) {
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Block size %dx%d invalid with this subsampling mode",
block_size_wide[subsize], block_size_high[subsize]);
assert(partition < PARTITION_TYPES);
assert(subsize < BLOCK_SIZES_ALL);
Supports Markdown
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