diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-07 21:58:27 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-14 01:30:11 +0200 |
commit | 813b3d11e0286b1d656633cd5717f3f43db5d1ac (patch) | |
tree | 32873c01b217dfd3f2e96bd361f8f321c2029751 | |
parent | 29ff1a5f1a013cd25f34fe8987877c55ad82cac7 (diff) | |
download | ffmpeg-813b3d11e0286b1d656633cd5717f3f43db5d1ac.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>
-rw-r--r-- | libavcodec/sanm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index aaf7434605..77811af92f 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -725,6 +725,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) |