diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-13 13:56:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-13 13:57:07 +0200 |
commit | 67d5d97cdcd7ada748320edf34453d94668a67c6 (patch) | |
tree | da43716d756a1c8f08632a376c4da26ce5a9db8d /libavcodec/4xm.c | |
parent | dbddd587e13b9bf718ee0eb0d183be6d8ffb996f (diff) | |
parent | be373cb50d3c411366fec7eef2eb3681abe48f96 (diff) | |
download | ffmpeg-67d5d97cdcd7ada748320edf34453d94668a67c6.tar.gz |
Merge commit 'be373cb50d3c411366fec7eef2eb3681abe48f96'
* commit 'be373cb50d3c411366fec7eef2eb3681abe48f96':
4xm: do not overread the prestream buffer
Conflicts:
libavcodec/4xm.c
See: 9c661e95
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/4xm.c')
-rw-r--r-- | libavcodec/4xm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 6a2476dcfd..bb380f6779 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -603,7 +603,8 @@ static int decode_i_mb(FourXContext *f) } static const uint8_t *read_huffman_tables(FourXContext *f, - const uint8_t * const buf, int buf_size) + const uint8_t * const buf, + int buf_size) { int frequency[512] = { 0 }; uint8_t flag[512]; @@ -626,6 +627,7 @@ static const uint8_t *read_huffman_tables(FourXContext *f, av_log(f->avctx, AV_LOG_ERROR, "invalid data in read_huffman_tables\n"); return NULL; } + for (i = start; i <= end; i++) frequency[i] = *ptr++; start = *ptr++; @@ -779,7 +781,7 @@ static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, i return AVERROR_INVALIDDATA; } - prestream = read_huffman_tables(f, prestream, buf + length - prestream); + prestream = read_huffman_tables(f, prestream, prestream_size); if (!prestream) { av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n"); return AVERROR_INVALIDDATA; |