On 14/01/2020 16:53, Paul-Antoine Arras wrote:

I'm stumbling upon a weird message from Valgrind when run on my application as follows:

$ valgrind --vgdb=yes --vgdb-error=0 --undef-value-errors=no $my_app

So Valgrind reports:

==1644== Thread 9:
==1644== Invalid read of size 8
==1644==    at 0x4A39B40: PR_int__give_lang_env_for_slave (PR__int.c:348)
==1644==  Address 0x12d152c8 is 24 bytes inside a block of size 104 alloc'd
==1644==    at 0x483577F: malloc (vg_replace_malloc.c:309)
==1644==    by 0x4A3C4B4: [...]

I struggle to understand how a read into a block of properly alloc'd memory can be invalid, given that the application doesn't use client requests.
To be sure, I double-checked the status of the entire buffer under vgdb:

(gdb) mo xb 0x12d152b0 104
[...]
Address 0x12D152B0 len 104 has 104 bytes unaddressable

How can a block of dynamically-allocated memory be marked unaddressable without having been freed?

By using the VALGRIND_MAKE_MEM_NOACCESS macro.

Tom

--
Tom Hughes (t...@compton.nu)
http://compton.nu/


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to