From 7ecfe4dc363435c81e66dd14881dc0b0ccc73fb1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 19 May 2016 18:02:53 +0200 Subject: [PATCH] avcodec/diracdec: Fix potential integer overflow Fixes CID1361948 Signed-off-by: Michael Niedermayer --- libavcodec/diracdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 05c79005eb..1d7bb9b98b 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -903,8 +903,8 @@ static int decode_lowdelay(DiracContext *s) } else { for (slice_y = 0; bufsize > 0 && slice_y < s->num_y; slice_y++) { for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) { - bytes = (slice_num+1) * s->lowdelay.bytes.num / s->lowdelay.bytes.den - - slice_num * s->lowdelay.bytes.num / s->lowdelay.bytes.den; + bytes = (slice_num+1) * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den + - slice_num * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den; slices[slice_num].bytes = bytes; slices[slice_num].slice_x = slice_x; slices[slice_num].slice_y = slice_y;