diff options
author | James Almer <jamrial@gmail.com> | 2020-07-10 17:16:49 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-07-17 15:24:56 -0300 |
commit | 03ad76794e23bbbc2a9aafeef631efcc5f91435e (patch) | |
tree | d5827faafaaedc44255c5fa3404b2a00ad6fc22f /libavcodec/libx264.c | |
parent | d1bd079d1144d1d882cf9a1ec8883388526e4604 (diff) | |
download | ffmpeg-03ad76794e23bbbc2a9aafeef631efcc5f91435e.tar.gz |
avcodec/libx264: check for param allocation failure error code
And return the proper AVERROR value.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r-- | libavcodec/libx264.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 4a82e1ba25..479dfe323c 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -529,6 +529,12 @@ static int parse_opts(AVCodecContext *avctx, const char *opt, const char *param) av_log(avctx, AV_LOG_ERROR, "bad option '%s': '%s'\n", opt, param); ret = AVERROR(EINVAL); +#if X264_BUILD >= 161 + } else if (ret == X264_PARAM_ALLOC_FAILED) { + av_log(avctx, AV_LOG_ERROR, + "out of memory parsing option '%s': '%s'\n", opt, param); + ret = AVERROR(ENOMEM); +#endif } else { av_log(avctx, AV_LOG_ERROR, "bad value for '%s': '%s'\n", opt, param); @@ -914,10 +920,15 @@ FF_ENABLE_DEPRECATION_WARNINGS { AVDictionaryEntry *en = NULL; while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) { - if (x264_param_parse(&x4->params, en->key, en->value) < 0) + if ((ret = x264_param_parse(&x4->params, en->key, en->value)) < 0) { av_log(avctx, AV_LOG_WARNING, "Error parsing option '%s = %s'.\n", en->key, en->value); +#if X264_BUILD >= 161 + if (ret == X264_PARAM_ALLOC_FAILED) + return AVERROR(ENOMEM); +#endif + } } } |