diff options
author | James Zern <jzern@google.com> | 2022-04-11 11:41:19 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2022-04-11 11:41:19 -0700 |
commit | a3cd75e29bdc1ca9df81f944a6c873220509fda8 (patch) | |
tree | 7a998a47ad5cbb51f8ad57daef7c7bd4984a0612 /vpxdec.c | |
parent | 6e1b7c6c14fea5d972bdd1162b51fc93942222a2 (diff) | |
download | libvpx-a3cd75e29bdc1ca9df81f944a6c873220509fda8.tar libvpx-a3cd75e29bdc1ca9df81f944a6c873220509fda8.tar.gz libvpx-a3cd75e29bdc1ca9df81f944a6c873220509fda8.tar.bz2 libvpx-a3cd75e29bdc1ca9df81f944a6c873220509fda8.zip |
vpxdec: add some allocation checks
see also: https://crbug.com/aomedia/3244
Change-Id: I7d151e63a91b8c1a5ee4e861f0b8461eeece6a2f
Diffstat (limited to 'vpxdec.c')
-rw-r--r-- | vpxdec.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -815,6 +815,10 @@ static int main_loop(int argc, const char **argv_) { ext_fb_list.num_external_frame_buffers = num_external_frame_buffers; ext_fb_list.ext_fb = (struct ExternalFrameBuffer *)calloc( num_external_frame_buffers, sizeof(*ext_fb_list.ext_fb)); + if (!ext_fb_list.ext_fb) { + fprintf(stderr, "Failed to allocate ExternalFrameBuffer\n"); + goto fail; + } if (vpx_codec_set_frame_buffer_functions(&decoder, get_vp9_frame_buffer, release_vp9_frame_buffer, &ext_fb_list)) { @@ -930,6 +934,11 @@ static int main_loop(int argc, const char **argv_) { } scaled_img = vpx_img_alloc(NULL, img->fmt, render_width, render_height, 16); + if (!scaled_img) { + fprintf(stderr, "Failed to allocate scaled image (%d x %d)\n", + render_width, render_height); + goto fail; + } scaled_img->bit_depth = img->bit_depth; } @@ -966,6 +975,10 @@ static int main_loop(int argc, const char **argv_) { if (!img_shifted) { img_shifted = vpx_img_alloc(NULL, shifted_fmt, img->d_w, img->d_h, 16); + if (!img_shifted) { + fprintf(stderr, "Failed to allocate image\n"); + goto fail; + } img_shifted->bit_depth = output_bit_depth; } if (output_bit_depth > img->bit_depth) { |