Commit 2dbc84b1 authored by Nicolas George's avatar Nicolas George

lavf/matroskaenc: check for overflow in display width.

parent 7897919a
...@@ -637,7 +637,11 @@ static int mkv_write_tracks(AVFormatContext *s) ...@@ -637,7 +637,11 @@ static int mkv_write_tracks(AVFormatContext *s)
} }
if (st->sample_aspect_ratio.num) { if (st->sample_aspect_ratio.num) {
int d_width = av_rescale(codec->width, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); int64_t d_width = av_rescale(codec->width, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
if (d_width > INT_MAX) {
av_log(s, AV_LOG_ERROR, "Overflow in display width\n");
return AVERROR(EINVAL);
}
put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width); put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width);
put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, codec->height); put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, codec->height);
} }
......
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