diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-01-13 03:51:39 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-13 05:04:13 +0100 |
commit | 22bfb4be284c12f33b9dac010713fe3ca6d974bf (patch) | |
tree | 40cdb13b0dc25c3e2fa1cd83ae68101af79f9c35 /libavcodec/hevc.c | |
parent | aead772b5814142b0e530804486ff7970ecd9eef (diff) | |
download | ffmpeg-22bfb4be284c12f33b9dac010713fe3ca6d974bf.tar.gz |
avcodec/hevc: Check entry point arrays for malloc failure
Fixes null pointer dereference
Fixes: signal_sigsegv_e1d3b6_2192_DBLK_F_VIXS_2.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r-- | libavcodec/hevc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 5cdb1ed75f..f8e81a7f0e 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -654,6 +654,11 @@ static int hls_slice_header(HEVCContext *s) sh->entry_point_offset = av_malloc(sh->num_entry_point_offsets * sizeof(int)); sh->offset = av_malloc(sh->num_entry_point_offsets * sizeof(int)); sh->size = av_malloc(sh->num_entry_point_offsets * sizeof(int)); + if (!sh->entry_point_offset || !sh->offset || !sh->size) { + sh->num_entry_point_offsets = 0; + av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate memory\n"); + return AVERROR(ENOMEM); + } for (i = 0; i < sh->num_entry_point_offsets; i++) { int val = 0; for (j = 0; j < segments; j++) { |