summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-28 17:26:05 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-28 20:10:51 +0100
commit4f03bebc79f76df3a3e5bb9e1bc32baabfb7797c (patch)
tree3b38a6ffb8ea4c0d991b9c18e9e3b3da5c0f5425 /libavcodec/utils.c
parent13696c378989252da2706f357b330240a46ea7f3 (diff)
avcodec/utils: Use 64bit for aspect ratio calculation in avcodec_string()
Fixes integer overflow Fixes: 3a45b2ae02f2cf12b7bd99543cdcdae5/asan_heap-oob_1dff502_8022_899f75e1e81046ebd7b6c2394a1419f4.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e279147b36..e018e445f4 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2760,8 +2760,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
if (enc->sample_aspect_ratio.num) {
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
- enc->width * enc->sample_aspect_ratio.num,
- enc->height * enc->sample_aspect_ratio.den,
+ enc->width * (int64_t)enc->sample_aspect_ratio.num,
+ enc->height * (int64_t)enc->sample_aspect_ratio.den,
1024 * 1024);
snprintf(buf + strlen(buf), buf_size - strlen(buf),
" [SAR %d:%d DAR %d:%d]",