summaryrefslogtreecommitdiff
path: root/vp8/vp8_cx_iface.c
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2018-01-25 11:36:53 -0800
committerJerome Jiang <jianj@google.com>2018-02-01 20:17:54 -0800
commit519fed01c2846ab9294543a3d2d65efaa51ec85b (patch)
tree8a4b3b1d8e2891f9ccd5715e2e7e116f7ece3358 /vp8/vp8_cx_iface.c
parentd069f4c29d6958944ad145faeac8e57f8de9f353 (diff)
downloadlibvpx-519fed01c2846ab9294543a3d2d65efaa51ec85b.tar
libvpx-519fed01c2846ab9294543a3d2d65efaa51ec85b.tar.gz
libvpx-519fed01c2846ab9294543a3d2d65efaa51ec85b.tar.bz2
libvpx-519fed01c2846ab9294543a3d2d65efaa51ec85b.zip
Fix issue for 0 target bitrate in multi-res build.
For encoding with --enable-multi-res-encoding, with 1 layer, when the target bitrate is set 0, under these conditions null pointer will be de-referenced. Fix is to check cpi->oxcf.mr_total_resolutions > 1. Also added NULL pointer check. This issue causes crash for asan build in chromium clusterfuzz. BUG=805863 Change-Id: I9cd25af631395bc9fede3a12fb68af4021eb15f8
Diffstat (limited to 'vp8/vp8_cx_iface.c')
-rw-r--r--vp8/vp8_cx_iface.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
index 784e8c359..d3e200594 100644
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -804,11 +804,15 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx,
if (!ctx->cfg.rc_target_bitrate) {
#if CONFIG_MULTI_RES_ENCODING
- LOWER_RES_FRAME_INFO *low_res_frame_info =
- (LOWER_RES_FRAME_INFO *)ctx->cpi->oxcf.mr_low_res_mode_info;
- low_res_frame_info->skip_encoding_prev_stream = 1;
- if (ctx->cpi->oxcf.mr_encoder_id == 0)
- low_res_frame_info->skip_encoding_base_stream = 1;
+ if (!ctx->cpi) return VPX_CODEC_ERROR;
+ if (ctx->cpi->oxcf.mr_total_resolutions > 1) {
+ LOWER_RES_FRAME_INFO *low_res_frame_info =
+ (LOWER_RES_FRAME_INFO *)ctx->cpi->oxcf.mr_low_res_mode_info;
+ if (!low_res_frame_info) return VPX_CODEC_ERROR;
+ low_res_frame_info->skip_encoding_prev_stream = 1;
+ if (ctx->cpi->oxcf.mr_encoder_id == 0)
+ low_res_frame_info->skip_encoding_base_stream = 1;
+ }
#endif
return res;
}