[FFmpeg-devel] [PATCH] avutil/avstring: dont mess with NULL pointers in av_match_list()

Michael Niedermayer michael at niedermayer.cc
Wed Jan 15 05:30:47 EET 2025


Fixes: applying zero offset to null pointer

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavutil/avstring.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 2071dd36a59..875eb691db6 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -452,10 +452,12 @@ int av_match_list(const char *name, const char *list, char separator)
                 if (k && (!p[k] || p[k] == separator))
                     return 1;
             q = strchr(q, separator);
-            q += !!q;
+            if(q)
+                q++;
         }
         p = strchr(p, separator);
-        p += !!p;
+        if (p)
+            p++;
     }
 
     return 0;
-- 
2.47.0



More information about the ffmpeg-devel mailing list