Commit 5c73c003 authored by Rupert Swarbrick's avatar Rupert Swarbrick Committed by Debargha Mukherjee
Browse files

Replace an assertion with a proper error on bad bitstream

The example in bug 712 is a bitstream that signals a global motion
type of ROTZOOM, but its second frame has shear parameters that fail
the is_affine_shear_allowed check at warped_motion.c:754. This is
quite possible (and it's not obvious how to change the bitstream
format so that you can't signal something like this).

This patch replaces the failing assertion with a proper "no you
can't!" error.


Change-Id: I6a32632d17031b777acd2f78a887491a40177785
parent 1c8cdef5
......@@ -4726,9 +4726,9 @@ static void read_supertx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
static void read_global_motion_params(WarpedMotionParams *params,
WarpedMotionParams *ref_params,
aom_reader *r, int allow_hp) {
static int read_global_motion_params(WarpedMotionParams *params,
WarpedMotionParams *ref_params,
aom_reader *r, int allow_hp) {
TransformationType type = aom_read_bit(r, ACCT_STR);
if (type != IDENTITY) {
......@@ -4818,16 +4818,24 @@ static void read_global_motion_params(WarpedMotionParams *params,
case IDENTITY: break;
default: assert(0);
if (params->wmtype <= AFFINE)
if (!get_shear_params(params)) assert(0);
if (params->wmtype <= AFFINE) {
int good_shear_params = get_shear_params(params);
if (!good_shear_params) return 0;
return 1;
static void read_global_motion(AV1_COMMON *cm, aom_reader *r) {
int frame;
for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) {
&cm->prev_frame->global_motion[frame], r,
int good_params = read_global_motion_params(
&cm->global_motion[frame], &cm->prev_frame->global_motion[frame], r,
if (!good_params)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Invalid shear parameters for global motion.");
// TODO(sarahparker, debargha): The logic in the commented out code below
// does not work currently and causes mismatches when resize is on. Fix it
// before turning the optimization back on.
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