aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-07 21:58:27 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-09 22:16:23 +0200
commit524d0d2cfc7bab1b348f85e7c0369859e63781cf (patch)
treed9979a2fb0237ea6bc777aa4f8de0aa6c2a91e77 /libavcodec
parent91f04e741096f5ced87f696adb924c6817d6f77c (diff)
downloadffmpeg-524d0d2cfc7bab1b348f85e7c0369859e63781cf.tar.gz
sanm: Check dimensions before use
Fixes integer overflow and out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 9dd04f6d8cdd1c10c28b2cb4252c1a41df581915) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/sanm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index caeaa366a6..61c3006068 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -739,6 +739,11 @@ static int process_frame_obj(SANMVideoContext *ctx)
w = bytestream2_get_le16u(&ctx->gb);
h = bytestream2_get_le16u(&ctx->gb);
+ if (!w || !h) {
+ av_log(ctx->avctx, AV_LOG_ERROR, "dimensions are invalid\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (ctx->width < left + w || ctx->height < top + h) {
if (av_image_check_size(FFMAX(left + w, ctx->width),
FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0)