Browse Source

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>
tags/n2.0
Michael Niedermayer 12 years ago
parent
commit
67d5d97cdc
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      libavcodec/4xm.c

+ 4
- 2
libavcodec/4xm.c View File

@@ -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,
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
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;


Loading…
Cancel
Save