Valgrind

Valgrind offers various mechanism to detect different types of problems concerning the handling of dynamic memory. The memcheck package of the valgrind framework was used to create the following outputs for our test cases. Each snippet corresponds to one of the test programs. As can be seen almost all test cases can be detected with valgrind.

The full output of valgrind is suppressed in the given output snippets due to the complexity and length of the full reports of this tool.

 

Error 01

==XX== Use of uninitialised value of size 4
==XX==    at 0x804840A: main (error1.c:9)
==XX== 
==XX== Process terminating with default action of signal 11 (SIGSEGV)
==XX==  Bad permissions for mapped region at address 0x400D290
==XX==    at 0x804840A: main (error1.c:9)

Error 02

==XX== Use of uninitialised value of size 4
==XX==    at 0x804849D: main (error2.c:10)
==XX== 
==XX== Process terminating with default action of signal 11 (SIGSEGV)
==XX==  Bad permissions for mapped region at address 0x400D2A4
==XX==    at 0x804849D: main (error2.c:10)

Error 03

==XX== Invalid write of size 4
==XX==    at 0x804846E: main (in error3.c.prog)
==XX== 
==XX== Process terminating with default action of signal 11 (SIGSEGV)
==XX==  Access not within mapped region at address 0x0
==XX==    at 0x804846E: main (in error3.c.prog)

Error 04

==XX== Invalid write of size 4
==XX==    at 0x8048442: main (error4.c:11)
==XX==  Address 0x4168070 is 8 bytes inside a block of size 10 alloc'd
==XX==    at 0x4020396: malloc (vg_replace_malloc.c:149)
==XX==    by 0x804842C: main (error4.c:10)

Error 06.01

==XX== Invalid free() / delete / delete[]
==XX==    at 0x401FFB0: free (vg_replace_malloc.c:233)
==XX==    by 0x80484FC: main (in err_6-mem_leaks/prog)
==XX==  Address 0x400D290 is not stack'd, malloc'd or (recently) free'd

Error 06.02

==XX== malloc/free: in use at exit: 40 bytes in 1 blocks.
==XX== malloc/free: 1 allocs, 0 frees, 40 bytes allocated.

Error 07

==XX== Invalid write of size 1
==XX==    at 0x80484C0: main (error7.c:17)
==XX==  Address 0x4168028 is 0 bytes inside a block of size 8 free'd
==XX==    at 0x401FFB0: free (vg_replace_malloc.c:233)
==XX==    by 0x8048473: main (error8.c:11)

Error 08

==XX== Invalid free() / delete / delete[]
==XX==    at 0x401FFB0: free (vg_replace_malloc.c:233)
==XX==    by 0x80483F2: main (error8.c:10)
==XX==  Address 0xBEF0E743 is on thread 1's stack

==XX== Invalid free() / delete / delete[]
==XX==    at 0x401FFB0: free (vg_replace_malloc.c:233)
==XX==    by 0x804841A: main (error8.c:15)
==XX==  Address 0xBEF0E714 is on thread 1's stack