aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-19 23:37:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-17 20:35:19 +0200
commitfe27d3f02f41c577c7f01e52f6c86bead689007f (patch)
tree81e1eeabd675fbfbfc426ad0b63a8a22a053f87c /libavcodec
parent0465fc58e86bd02d8fd7f4046209d715a8ea43bc (diff)
downloadffmpeg-fe27d3f02f41c577c7f01e52f6c86bead689007f.tar.gz
avcodec/srtdec: Fix signed integer overflow: 1811992524 * 384 cannot be represented in type 'int'
Fixes: 617/clusterfuzz-testcase-6413875723370496 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit c11d3634b07b4aa71f75478aa1bcb63b0c22e030) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/srtdec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index 542dd35795..d830d7ca6f 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -38,13 +38,13 @@ static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,
/* text rectangle defined, write the text at the center of the rectangle */
const int cx = x1 + (x2 - x1)/2;
const int cy = y1 + (y2 - y1)/2;
- const int scaled_x = cx * ASS_DEFAULT_PLAYRESX / 720;
- const int scaled_y = cy * ASS_DEFAULT_PLAYRESY / 480;
+ const int scaled_x = cx * (int64_t)ASS_DEFAULT_PLAYRESX / 720;
+ const int scaled_y = cy * (int64_t)ASS_DEFAULT_PLAYRESY / 480;
av_bprintf(dst, "{\\an5}{\\pos(%d,%d)}", scaled_x, scaled_y);
} else {
/* only the top left corner, assume the text starts in that corner */
- const int scaled_x = x1 * ASS_DEFAULT_PLAYRESX / 720;
- const int scaled_y = y1 * ASS_DEFAULT_PLAYRESY / 480;
+ const int scaled_x = x1 * (int64_t)ASS_DEFAULT_PLAYRESX / 720;
+ const int scaled_y = y1 * (int64_t)ASS_DEFAULT_PLAYRESY / 480;
av_bprintf(dst, "{\\an1}{\\pos(%d,%d)}", scaled_x, scaled_y);
}
}