aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2013-04-13 11:46:56 +0200
committerNicolas George <nicolas.george@normalesup.org>2013-04-13 20:19:24 +0200
commit9e8e03de38b3deb6bee546a37e1a3ff05cf5f746 (patch)
treef9ec61f2fa20b984dbeb3abc2b7213e085348e22
parent2a1d7ea5f8ba71e1ed96c17414f8d106c006d87a (diff)
downloadffmpeg-9e8e03de38b3deb6bee546a37e1a3ff05cf5f746.tar.gz
lavu/opt: check int lists length for overflow.
Also add parens on macro arguments.
-rw-r--r--libavutil/opt.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h
index e368259455..7f7b54e708 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -668,8 +668,10 @@ int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int searc
* @param flags search flags
*/
#define av_opt_set_int_list(obj, name, val, term, flags) \
- av_opt_set_bin(obj, name, (const uint8_t *)val, \
- av_int_list_length(val, term) * sizeof(*val), flags)
+ (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \
+ AVERROR(EINVAL) : \
+ av_opt_set_bin(obj, name, (const uint8_t *)(val), \
+ av_int_list_length(val, term) * sizeof(*(val)), flags))
/**
* @}
*/