diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-05 22:08:59 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-20 10:59:27 +0100 |
commit | 929fd61602710211ccfd3c7fd8093fb6b032ad86 (patch) | |
tree | 18d0b1a6eb7074cabc9975d189d5c76c3109a976 | |
parent | 09305dca59fd36509b593292a78ef7e7cf8220fd (diff) | |
download | ffmpeg-929fd61602710211ccfd3c7fd8093fb6b032ad86.tar.gz |
avcodec/hevc: Fix integer overflow of entry_point_offset
Fixes out of array read
Fixes: d41d8cd98f00b204e9800998ecf8427e/signal_sigsegv_321165b_7641_077dfcd8cbc80b1c0b470c8554cd6ffb.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 214085852491448631dcecb008b5d172c11b8892)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/hevc.c | 4 | ||||
-rw-r--r-- | libavcodec/hevc.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 66ebf3d890..a8643d0cca 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -716,7 +716,7 @@ static int hls_slice_header(HEVCContext *s) av_freep(&sh->entry_point_offset); av_freep(&sh->offset); av_freep(&sh->size); - sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int)); + sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(unsigned)); sh->offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int)); sh->size = av_malloc_array(sh->num_entry_point_offsets, sizeof(int)); if (!sh->entry_point_offset || !sh->offset || !sh->size) { @@ -2421,7 +2421,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length) int *ret = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int)); int *arg = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int)); int64_t offset; - int startheader, cmpt = 0; + int64_t startheader, cmpt = 0; int i, j, res = 0; if (!ret || !arg) { diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 22d698903a..9e183b71b0 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -609,7 +609,7 @@ typedef struct SliceHeader { unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand - int *entry_point_offset; + unsigned *entry_point_offset; int * offset; int * size; int num_entry_point_offsets; |