Validate pointer before reset
BUG=aomedia:1461
Change-Id: I483063a2bb16e236b26aff01c2e81d1753b1e837
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index bde1e78..3059662 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -1176,8 +1176,13 @@
av1_zero_array(cm->above_context[0] + offset_y, width_y);
if (num_planes > 1) {
- av1_zero_array(cm->above_context[1] + offset_uv, width_uv);
- av1_zero_array(cm->above_context[2] + offset_uv, width_uv);
+ if (cm->above_context[1] && cm->above_context[2]) {
+ av1_zero_array(cm->above_context[1] + offset_uv, width_uv);
+ av1_zero_array(cm->above_context[2] + offset_uv, width_uv);
+ } else {
+ aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
+ "Invalid value of planes");
+ }
}
av1_zero_array(cm->above_seg_context + mi_col_start, aligned_width);