ref: c56ab7d0c6f3fb215d571db3dacc0cc908c1b53c
parent: e259e6951d794ca6a6f2f3c9c40c5c99818613d3
parent: 27b8a778bdbaaf803c2a15eb4d96837757480106
author: James Zern <jzern@google.com>
date: Fri Oct 15 16:08:58 EDT 2021
Merge "vp8_yv12_realloc_frame_buffer: move allocation check" into main
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -64,6 +64,10 @@
if (!ybf->buffer_alloc) {
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, frame_size);
+ if (!ybf->buffer_alloc) {
+ ybf->buffer_alloc_sz = 0;
+ return -1;
+ }
#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
// This memset is needed for fixing the issue of using uninitialized
@@ -75,7 +79,7 @@
ybf->buffer_alloc_sz = frame_size;
}
- if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) return -1;
+ if (ybf->buffer_alloc_sz < frame_size) return -1;
/* Only support allocating buffers that have a border that's a multiple
* of 32. The border restriction is required to get 16-byte alignment of