ref: 27b8a778bdbaaf803c2a15eb4d96837757480106
parent: 7aabd6968278130da885f6c35ee12b19a1e7be72
author: James Zern <jzern@google.com>
date: Fri Oct 8 12:24:23 EDT 2021
vp8_yv12_realloc_frame_buffer: move allocation check to before the memset used under msan to avoid any spurious reports in OOM conditions Change-Id: I0c4ee92829bbcb356e94f503a4615caf891bb49d
--- 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