summaryrefslogtreecommitdiff
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-24 19:23:23 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-24 19:23:23 +0200
commit4641ae352ec587355764ffd5c43dd0d0ebd47654 (patch)
treeda175629ebf72bf55a504dd2d0240b1034892f4e /libavformat/avidec.c
parente56425d1a71828c32f7f355f0979534e1007078f (diff)
avformat: Add and use ff_copy_whitelists()
Fixes potential security issue in case of running out of memory Found-by: ubitux Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index e4f43a29a7..0cdcc08f65 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1040,9 +1040,8 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt)
ast->sub_ctx->pb = pb;
- av_assert0(!ast->sub_ctx->codec_whitelist && !ast->sub_ctx->format_whitelist);
- ast->sub_ctx-> codec_whitelist = av_strdup(s->codec_whitelist);
- ast->sub_ctx->format_whitelist = av_strdup(s->format_whitelist);
+ if (ff_copy_whitelists(ast->sub_ctx, s) < 0)
+ goto error;
if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) {
ff_read_packet(ast->sub_ctx, &ast->sub_pkt);
@@ -1056,6 +1055,7 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt)
return 1;
error:
+ av_freep(&ast->sub_ctx);
av_freep(&pb);
}
return 0;