diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 2de6dc2103..4ce4b6403e 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -468,7 +468,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty return; } - buf_size = FFMAX(2*length, LEN_PRETTY_GUID) + 1; + buf_size = FFMIN(FFMAX(2U * length, LEN_PRETTY_GUID) + 1, INT_MAX); buf = av_malloc(buf_size); if (!buf) return;