]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix: testsolv segfault
authorJaroslav Rohel <jrohel@redhat.com>
Tue, 11 Dec 2018 09:22:09 +0000 (10:22 +0100)
committerJaroslav Rohel <jrohel@redhat.com>
Tue, 11 Dec 2018 12:31:18 +0000 (13:31 +0100)
ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fab0e11bf2b bp 0x7ffdfc044b70 sp 0x7ffdfc044a90 T0)
0 0x7fab0e11bf2a in testcase_str2dep_complex /home/company/real_sanitize/libsolv-master/ext/testcase.c:577
1 0x7fab0e11c80f in testcase_str2dep /home/company/real_sanitize/libsolv-master/ext/testcase.c:656
2 0x7fab0e12e64a in testcase_read /home/company/real_sanitize/libsolv-master/ext/testcase.c:2952
3 0x402aa5 in main /home/company/real_sanitize/libsolv-master/tools/testsolv.c:148
4 0x7fab0d9d2a3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
5 0x401bb8 in _start (/home/company/real_sanitize/libsolv-master/build/install/bin/testsolv+0x401bb8)

ext/testcase.c

index 33998d470c27b85691c6449d8e1d12466bd19704..fe2636cb2b51549fa0f3cbb1a197a178bd9b36b5 100644 (file)
@@ -576,6 +576,8 @@ testcase_str2dep_complex(Pool *pool, const char **sp, int relop)
   Id flags, id, id2, namespaceid = 0;
   struct oplist *op;
 
+  if (!s)
+    return 0;
   while (*s == ' ' || *s == '\t')
     s++;
   if (!strncmp(s, "namespace:", 10))