[FFmpeg-devel] [PATCH 1/2] avcodec/bitstream_filters: check the input argument of av_bsf_get_by_name() for NULL

James Almer jamrial at gmail.com
Sat Jul 28 06:58:47 EEST 2018


Fixes crashes like "ffmpeg -h bsf" caused by passing NULL to strcmp()

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/bitstream_filters.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index c21373621c..3433921554 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -78,6 +78,9 @@ const AVBitStreamFilter *av_bsf_get_by_name(const char *name)
     const AVBitStreamFilter *f = NULL;
     void *i = 0;
 
+    if (!name)
+        return NULL;
+
     while ((f = av_bsf_iterate(&i))) {
         if (!strcmp(f->name, name))
             return f;
-- 
2.18.0



More information about the ffmpeg-devel mailing list