]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix: testsolv segfaults
authorJaroslav Rohel <jrohel@redhat.com>
Tue, 11 Dec 2018 09:27:15 +0000 (10:27 +0100)
committerJaroslav Rohel <jrohel@redhat.com>
Tue, 11 Dec 2018 12:32:58 +0000 (13:32 +0100)
ERROR: AddressSanitizer: SEGV on unknown address 0x0000000002f0 (pc 0x7f31501d3bd2 bp 0x7ffcfe4d4a50 sp 0x7ffcfe4d4a30 T0)
0 0x7f31501d3bd1 in pool_whatprovides /home/company/real_sanitize/libsolv-master/src/pool.h:331
1 0x7f31501d895e in testcase_str2solvid /home/company/real_sanitize/libsolv-master/ext/testcase.c:793
2 0x7f31501e8388 in testcase_read /home/company/real_sanitize/libsolv-master/ext/testcase.c:2807
3 0x402aa5 in main /home/company/real_sanitize/libsolv-master/tools/testsolv.c:148
4 0x7f314fa8da3f 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)

ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f5af9e7815f bp 0x7ffc4c843a40 sp 0x7ffc4c8436c0 T0)
0 0x7f5af9e7815e in testcase_read /home/company/real_sanitize/libsolv-master/ext/testcase.c:2799
1 0x402aa5 in main /home/company/real_sanitize/libsolv-master/tools/testsolv.c:148
2 0x7f5af971da3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
3 0x401bb8 in _start (/home/company/real_sanitize/libsolv-master/build/install/bin/testsolv+0x401bb8)

ext/testcase.c

index fe2636cb2b51549fa0f3cbb1a197a178bd9b36b5..c8dd14ee412957b178793eb7737e0e687bd7458d 100644 (file)
@@ -2795,7 +2795,7 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
        {
          int i = strlen(pieces[1]);
          s = strchr(pieces[1], '(');
-         if (!s && pieces[1][i - 1] != ')')
+         if (!s || pieces[1][i - 1] != ')')
            {
              pool_error(pool, 0, "testcase_read: bad namespace '%s'", pieces[1]);
            }