[FFmpeg-devel] [PATCH] tests/checkasm: prevent a segmentation fault when calling strncmp()
Sean McGovern
gseanmcg at gmail.com
Thu Jan 16 22:16:16 EET 2025
The POSIX specification for strncmp()[1] leaves this behaviour as
undefined if either pointer argument is NULL.
Prevent a segmentation fault by ensuring 'arg' is non-NULL.
[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncmp.html
---
tests/checkasm/checkasm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 14742081ca..4270ed170a 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -952,7 +952,7 @@ int main(int argc, char *argv[])
}
for (i = 1; i < argc; i++) {
- const char *arg = argv[i];
+ const char *arg = argv[i] != NULL ? argv[i] : "";
unsigned long l;
char *end;
--
2.39.5
More information about the ffmpeg-devel
mailing list