aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-12 02:03:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-03 02:41:12 +0100
commitf62537d9f1b43b04e64e7dec79049556f7bc31a7 (patch)
treec897b48e07b18f9e8098038fd686a3ff4993b404
parent4f873341b4d522b1bfa385a1f6fc86bb8b6dc879 (diff)
downloadffmpeg-f62537d9f1b43b04e64e7dec79049556f7bc31a7.tar.gz
sanm: Use the correct height variable in the decoded_size checks
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 5260edee7e5bd975837696c8c8c1a80eb2fbd7c1) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/sanm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 1d5d064976..aaf7434605 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -415,8 +415,8 @@ static int old_codec37(SANMVideoContext *ctx, int top,
flags = bytestream2_get_byte(&ctx->gb);
bytestream2_skip(&ctx->gb, 3);
- if (decoded_size > height * stride - left - top * stride) {
- decoded_size = height * stride - left - top * stride;
+ if (decoded_size > ctx->height * stride - left - top * stride) {
+ decoded_size = ctx->height * stride - left - top * stride;
av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
}
@@ -643,8 +643,8 @@ static int old_codec47(SANMVideoContext *ctx, int top,
decoded_size = bytestream2_get_le32(&ctx->gb);
bytestream2_skip(&ctx->gb, 8);
- if (decoded_size > height * stride - left - top * stride) {
- decoded_size = height * stride - left - top * stride;
+ if (decoded_size > ctx->height * stride - left - top * stride) {
+ decoded_size = ctx->height * stride - left - top * stride;
av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
}