summaryrefslogtreecommitdiff
path: root/libavformat/matroskaenc.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-12-12 21:19:24 +0100
committerNicolas George <nicolas.george@normalesup.org>2012-12-13 12:45:07 +0100
commit2dbc84b1a8d39e7fa0c7d66a120838fced35f5b4 (patch)
tree688df378e3d3951eb4ba951a85416cd2d3a9904b /libavformat/matroskaenc.c
parent7897919a88cd4be607497a367203e55fe11df9f0 (diff)
lavf/matroskaenc: check for overflow in display width.
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r--libavformat/matroskaenc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index adca74f111..c0c0a2d03e 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -637,7 +637,11 @@ static int mkv_write_tracks(AVFormatContext *s)
}
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_VIDEODISPLAYHEIGHT, codec->height);
}