[FFmpeg-devel] [PATCH] avcodec/bsf: set pctx to NULL when av_bsf_alloc failed
Steven Liu
lq at chinaffmpeg.org
Sat Jan 16 07:24:34 EET 2021
av_bsf_free will free invalid pointer when av_bsf_alloc failed.
because av_bsf_list_parse_str called av_bsf_get_null_filter,
av_bsf_get_null_filter called av_bsf_alloc, and av_bsf_alloc
should set a value to the *pctx before return success or failed,
because it dose not initial a null pointer ever, so it will free
invalid pointer in av_bsf_free which is called by ff_decode_bsfs_init.
Found-by: Zu-Ming Jiang <jjzuming at outlook.com>
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
libavcodec/bsf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index d71bc32584..5bb3349138 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -141,6 +141,7 @@ int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
return 0;
fail:
av_bsf_free(&ctx);
+ *pctx = NULL;
return ret;
}
--
2.15.1
More information about the ffmpeg-devel
mailing list