Properly reallocate buffers when bit depth changes
This commit removes a suspicious assert and replaces it with a proper action
when a change in bit depth happens, fixing one of the assertion failures shown
by the test case in the following bug.
BUG=oss-fuzz:10061
There may still other assertion failures with this test case.
Change-Id: Ib9a24fca0f90ce032a5d7d4261e515dc01050211
diff --git a/aom_scale/generic/yv12config.c b/aom_scale/generic/yv12config.c
index 5cfba88..72cd28a 100644
--- a/aom_scale/generic/yv12config.c
+++ b/aom_scale/generic/yv12config.c
@@ -177,7 +177,11 @@
ybf->y_buffer_8bit = (uint8_t *)aom_memalign(32, (size_t)yplane_size);
if (!ybf->y_buffer_8bit) return -1;
} else {
- assert(!ybf->y_buffer_8bit);
+ if (ybf->y_buffer_8bit) {
+ aom_free(ybf->y_buffer_8bit);
+ ybf->y_buffer_8bit = NULL;
+ ybf->buf_8bit_valid = 0;
+ }
}
ybf->corrupted = 0; /* assume not corrupted by errors */