diff options
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 7c14725d8b..5f48de1247 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -142,18 +142,21 @@ void av_format_inject_global_side_data(AVFormatContext *s) } } -int ff_copy_whitelists(AVFormatContext *dst, AVFormatContext *src) +int ff_copy_whiteblacklists(AVFormatContext *dst, AVFormatContext *src) { av_assert0(!dst->codec_whitelist && !dst->format_whitelist && - !dst->protocol_whitelist); + !dst->protocol_whitelist && + !dst->protocol_blacklist); dst-> codec_whitelist = av_strdup(src->codec_whitelist); dst->format_whitelist = av_strdup(src->format_whitelist); dst->protocol_whitelist = av_strdup(src->protocol_whitelist); + dst->protocol_blacklist = av_strdup(src->protocol_blacklist); if ( (src-> codec_whitelist && !dst-> codec_whitelist) || (src-> format_whitelist && !dst-> format_whitelist) - || (src->protocol_whitelist && !dst->protocol_whitelist)) { - av_log(dst, AV_LOG_ERROR, "Failed to duplicate whitelist\n"); + || (src->protocol_whitelist && !dst->protocol_whitelist) + || (src->protocol_blacklist && !dst->protocol_blacklist)) { + av_log(dst, AV_LOG_ERROR, "Failed to duplicate black/whitelist\n"); return AVERROR(ENOMEM); } return 0; @@ -460,6 +463,14 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, } } + if (!s->protocol_blacklist && s->pb && s->pb->protocol_blacklist) { + s->protocol_blacklist = av_strdup(s->pb->protocol_blacklist); + if (!s->protocol_blacklist) { + ret = AVERROR(ENOMEM); + goto fail; + } + } + if (s->format_whitelist && av_match_list(s->iformat->name, s->format_whitelist, ',') <= 0) { av_log(s, AV_LOG_ERROR, "Format not on whitelist \'%s\'\n", s->format_whitelist); ret = AVERROR(EINVAL); |