Commit 67d5d97c authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'be373cb5'

* commit 'be373cb5':
  4xm: do not overread the prestream buffer

Conflicts:
	libavcodec/4xm.c

See: 9c661e95Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents dbddd587 be373cb5
...@@ -603,7 +603,8 @@ static int decode_i_mb(FourXContext *f) ...@@ -603,7 +603,8 @@ static int decode_i_mb(FourXContext *f)
} }
static const uint8_t *read_huffman_tables(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 }; int frequency[512] = { 0 };
uint8_t flag[512]; uint8_t flag[512];
...@@ -626,6 +627,7 @@ static const uint8_t *read_huffman_tables(FourXContext *f, ...@@ -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"); av_log(f->avctx, AV_LOG_ERROR, "invalid data in read_huffman_tables\n");
return NULL; return NULL;
} }
for (i = start; i <= end; i++) for (i = start; i <= end; i++)
frequency[i] = *ptr++; frequency[i] = *ptr++;
start = *ptr++; start = *ptr++;
...@@ -779,7 +781,7 @@ static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, i ...@@ -779,7 +781,7 @@ static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, i
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
prestream = read_huffman_tables(f, prestream, buf + length - prestream); prestream = read_huffman_tables(f, prestream, prestream_size);
if (!prestream) { if (!prestream) {
av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n"); av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment