diff options
author | James Zern <jzern@google.com> | 2021-10-08 16:24:23 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2021-10-08 16:26:26 -0700 |
commit | 27b8a778bdbaaf803c2a15eb4d96837757480106 (patch) | |
tree | 169ac5a804ef13dccc3f94a346fcbc359027a7ee /vpx_scale | |
parent | 7aabd6968278130da885f6c35ee12b19a1e7be72 (diff) | |
download | libvpx-27b8a778bdbaaf803c2a15eb4d96837757480106.tar libvpx-27b8a778bdbaaf803c2a15eb4d96837757480106.tar.gz libvpx-27b8a778bdbaaf803c2a15eb4d96837757480106.tar.bz2 libvpx-27b8a778bdbaaf803c2a15eb4d96837757480106.zip |
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
Diffstat (limited to 'vpx_scale')
-rw-r--r-- | vpx_scale/generic/yv12config.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c index eee291c30..c52dab058 100644 --- a/vpx_scale/generic/yv12config.c +++ b/vpx_scale/generic/yv12config.c @@ -64,6 +64,10 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, 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 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, 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 |