diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-13 20:38:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-13 20:38:31 +0200 |
commit | 38e66af43b06aa6f1f5ca3722aa154c67cd287d1 (patch) | |
tree | 1e59626f7ad4d563385116e7e45f355e81ff042c /libavutil | |
parent | 536baf6cc5d1db789c9f903776dccb7a41b62a6e (diff) | |
parent | 9e8e03de38b3deb6bee546a37e1a3ff05cf5f746 (diff) | |
download | ffmpeg-38e66af43b06aa6f1f5ca3722aa154c67cd287d1.tar.gz |
Merge remote-tracking branch 'cigaes/master'
* cigaes/master:
lavu/opt: check int lists length for overflow.
lavu: add parens to macro argument.
lavu: add av_pure to av_int_list_length_for_size.
lavfi/buffersink: factor checks for lists sizes.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/avutil.h | 4 | ||||
-rw-r--r-- | libavutil/opt.h | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h index d71eb1ef4c..6f307d6c5d 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -261,7 +261,7 @@ static inline void *av_x_if_null(const void *p, const void *x) * @return length of the list, in elements, not counting the terminator */ unsigned av_int_list_length_for_size(unsigned elsize, - const void *list, uint64_t term); + const void *list, uint64_t term) av_pure; /** * Compute the length of an integer list. @@ -271,7 +271,7 @@ unsigned av_int_list_length_for_size(unsigned elsize, * @return length of the list, in elements, not counting the terminator */ #define av_int_list_length(list, term) \ - av_int_list_length_for_size(sizeof(*list), list, term) + av_int_list_length_for_size(sizeof(*(list)), list, term) /** * @} 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)) /** * @} */ |