Skip to content

Commit

Permalink
vp8_yv12_realloc_frame_buffer: move allocation check
Browse files Browse the repository at this point in the history
to before the memset used under msan to avoid any spurious reports in
OOM conditions

Change-Id: I0c4ee92829bbcb356e94f503a4615caf891bb49d
  • Loading branch information
jzern committed Oct 8, 2021
1 parent 7aabd69 commit 27b8a77
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vpx_scale/generic/yv12config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 27b8a77

Please sign in to comment.