Commit 4f03bebc authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 13696c37
...@@ -2760,8 +2760,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) ...@@ -2760,8 +2760,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
if (enc->sample_aspect_ratio.num) { if (enc->sample_aspect_ratio.num) {
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
enc->width * enc->sample_aspect_ratio.num, enc->width * (int64_t)enc->sample_aspect_ratio.num,
enc->height * enc->sample_aspect_ratio.den, enc->height * (int64_t)enc->sample_aspect_ratio.den,
1024 * 1024); 1024 * 1024);
snprintf(buf + strlen(buf), buf_size - strlen(buf), snprintf(buf + strlen(buf), buf_size - strlen(buf),
" [SAR %d:%d DAR %d:%d]", " [SAR %d:%d DAR %d:%d]",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment