aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-04-10 09:59:36 +0200
committerReinhard Tartler <siretart@tauware.de>2013-04-24 21:01:14 +0200
commit74753cf1a99b9ded5525a351ec536a3d5cb4c068 (patch)
treed8185b590d28547f6d68ba4398a73ea1946f7ad1
parent881526744eeac45a740157243503f046d9fa6473 (diff)
downloadffmpeg-74753cf1a99b9ded5525a351ec536a3d5cb4c068.tar.gz
indeo3: fix data size check
The data offsets are relative to the bistream header, which is 16 bytes after the start of the data. Fixes invalid reads with corrupted files. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org (cherry picked from commit 34e6af9e204ca6bb18d8cf8ec68fe19b0e083e95) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r--libavcodec/indeo3.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index 2aa8d955ac..83aadf6d54 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -887,8 +887,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
if (ctx->data_size == 16)
return 4;
- if (ctx->data_size > buf_size)
- ctx->data_size = buf_size;
+ ctx->data_size = FFMIN(ctx->data_size, buf_size - 16);
buf_ptr += 3; // skip reserved byte and checksum