code that causes the crash char *ps[2]; void split(char *str, char *s) { char *token; /* get the first token */ token = strtok(str, s); strcpy(ps[0],token); /* walk through other tokens */ while (token != NULL) { printf(" %s\n", token); token = strtok(NULL, s); strcpy(ps[1],token); return; } } ps[0]=malloc(sizeof(char) +100); ps[1]= malloc(sizeof(char) +100); the stack trace valgrind --leak-check=yes /home/clopez/projects/cmt_library/netbeans/TestCMT/dist/Debug/GNU-Linux-x86/testcmt ==11410== Memcheck, a memory error detector ==11410== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==11410== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info ==11410== Command: /home/clopez/projects/cmt_library/netbeans/TestCMT/dist/Debug/GNU-Linux-x86/testcmt ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFD6: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFD9: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFDE: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFE1: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFE6: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFE9: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFCE: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFD1: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x4C2F3A0: strcpy (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==11410== by 0x400CF9: split (DSPReader.c:73) ==11410== by 0x400E40: openFile (DSPReader.c:122) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x4C2F3A0: strcpy (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==11410== by 0x400E54: openFile (DSPReader.c:123) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFD6: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFD9: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFDE: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFE1: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFE6: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFE9: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Use of uninitialised value of size 8 ==11410== at 0x53EDFCE: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x53EDFD1: strtok (in /lib64/libc-2.25.so) ==11410== by 0x400CDF: split (DSPReader.c:72) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Conditional jump or move depends on uninitialised value(s) ==11410== at 0x4C2F3A0: strcpy (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==11410== by 0x400CF9: split (DSPReader.c:73) ==11410== by 0x400E9D: openFile (DSPReader.c:128) ==11410== by 0x401100: main (newmain.c:23) ==11410== ==11410== Invalid write of size 8 ==11410== at 0x401087: openFile (DSPReader.c:169) ==11410== by 0x401100: main (newmain.c:23) ==11410== Address 0x570f898 is 0 bytes after a block of size 1,032 alloc'd ==11410== at 0x4C2C0AF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==11410== by 0x400FF5: openFile (DSPReader.c:153) ==11410== by 0x401100: main (newmain.c:23) ==11410== --11410-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting --11410-- si_code=128; Faulting address: 0x0; sp: 0x802ba9e30 valgrind: the 'impossible' happened: Killed by fatal signal host stacktrace: ==11410== at 0x380930E7: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) ==11410== by 0x38050454: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) ==11410== by 0x38050626: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) ==11410== by 0x380D9993: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) ==11410== by 0x380E82B6: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) sched status: running_tid=1 Thread 1: status = VgTs_Runnable (lwpid 11410) ==11410== at 0x4C2C0AF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==11410== by 0x4E42D09: Cvalloc (cvalloc.c:21) ==11410== by 0x40111F: main (newmain.c:25) Note: see also the FAQ in the source distribution. It contains workarounds to several common problems. In particular, if Valgrind aborted or crashed after identifying problems in your program, there's a good chance that fixing those problems will prevent Valgrind aborting or crashing, especially if it happened in m_mallocfree.c. If that doesn't help, please report this bug to: www.valgrind.org In the bug report, send all the above text, the valgrind version, and what OS and version you are using. Thanks. gmake: *** [Makefile:132: test_valgrind] Error 1 MAKE FAILED (exit value 2, total time: 346ms)
gcc (SUSE Linux) 6.3.1 20170202 [gcc-6-branch revision 245119] Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. opensuse leap 43.2 Please let me know if more information is rq.
Please try to reproduce with the latest Valgrind compiled from sources: http://valgrind.org/downloads/repository.html Version 3.12.0 is quite old these days. Report also 'valgrind -v --version'. In addition to that, please attach the reproducer program as an attachment. I think it's incomplete as the guest stack trace refers to Cvalloc().
I think this is likely to be a bug in the application, not V. Plus, as Ivo says, it's for an old version. If you can still reproduce with 3.13 please reopen. But for now, I am closing this as invalid.