Commit 27e8298c authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '94aefb19'

* commit '94aefb19':
  4xm: do not overread the source buffer in decode_p_block

Conflicts:
	libavcodec/4xm.c

The checks are replaced by av_assert0() as the conditions should
be impossible. If these asserts fail, there is a bug elsewhere
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 67d5d97c 94aefb19
...@@ -375,6 +375,7 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, ...@@ -375,6 +375,7 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
log2w, log2h, stride)) < 0) log2w, log2h, stride)) < 0)
return ret; return ret;
} else if (code == 3 && f->version < 2) { } else if (code == 3 && f->version < 2) {
av_assert0(start <= src && src <= end);
mcdc(dst, src, log2w, h, stride, 1, 0); mcdc(dst, src, log2w, h, stride, 1, 0);
} else if (code == 4) { } else if (code == 4) {
if (bytestream2_get_bytes_left(&f->g) < 1) { if (bytestream2_get_bytes_left(&f->g) < 1) {
...@@ -396,6 +397,7 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, ...@@ -396,6 +397,7 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n"); av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
av_assert0(start <= src && src <= end);
mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16u(&f->g2)); mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16u(&f->g2));
} else if (code == 6) { } else if (code == 6) {
if (bytestream2_get_bytes_left(&f->g2) < 4) { if (bytestream2_get_bytes_left(&f->g2) < 4) {
......
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