Commit f8a613d6 authored by Derek Buitenhuis's avatar Derek Buitenhuis

fftools/ffprobe: Avoid overflow when calculating DAR

Both the codecpar's width and height, and the SAR num and den are
ints, which can overflow. Cast to int64_t, which is what av_reduce
takes.

Without this, occasionally, display_aspect_ratio can be negative in
ffprobe's -show_stream output.
Signed-off-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parent 088bf6e8
......@@ -3324,8 +3324,8 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
if (sar.num) {
print_q("sample_aspect_ratio", sar, ':');
av_reduce(&dar.num, &dar.den,
par->width * sar.num,
par->height * sar.den,
(int64_t) par->width * sar.num,
(int64_t) par->height * sar.den,
1024*1024);
print_q("display_aspect_ratio", dar, ':');
} else {
......
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