summaryrefslogtreecommitdiff
path: root/libavcodec/4xm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-13 14:51:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-13 14:51:59 +0200
commita9821bdafb3a8dc1f390b79c84f86fb94a46043b (patch)
treedb21f714af58f57bf8319a8b6e85242115f37f5d /libavcodec/4xm.c
parente9f2e9715b2bf7e379174b4ca3d23b11526561c0 (diff)
parent59d7bb99b6a963b7e11c637228b2203adf535eee (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: 4xm: check bitstream_size boundary before using it Conflicts: libavcodec/4xm.c See: 9c661e95 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/4xm.c')
-rw-r--r--libavcodec/4xm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 5a20c13b80..3e0e681331 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -766,7 +766,10 @@ static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, i
unsigned int prestream_size;
const uint8_t *prestream;
- if (bitstream_size > (1<<26) || length < bitstream_size + 12) {
+ if (bitstream_size > (1 << 26))
+ return AVERROR_INVALIDDATA;
+
+ if (length < bitstream_size + 12) {
av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
return AVERROR_INVALIDDATA;
}
@@ -775,7 +778,6 @@ static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, i
prestream = buf + bitstream_size + 12;
if (prestream_size + bitstream_size + 12 != length
- || bitstream_size > (1 << 26)
|| prestream_size > (1 << 26)) {
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n",
prestream_size, bitstream_size, length);