|
From: smiley g. <smi...@ya...> - 2005-04-22 13:14:07
|
The issue I am talking about here doesnot occur with
Valgrind 2.4.0. Occurs in 2.1.2. I am just curious
about the reason.
main(){
char * a, *b;
a = (char*)malloc(500);
b = (char*)malloc(500);
memcpy(a,b,500);
}
Compile above program using Intel 8.0 compiler.
icc -O2 -o mc mc.c
valgrind --tool=addrcheck ./mc
and you get the following error.
==26429== Invalid read of size 16
==26429== at 0x804A328: (within
/home/msadasiv/projects/valit/prgs/nls_memcpy_bug/mc)
==26429== by 0x3424C79C: __libc_start_main (in
/lib/tls/libc-2.3.2.so)
==26429== by 0x8048630: (within
/home/msadasiv/projects/valit/prgs/nls_memcpy_bug/mc)
==26429== Address 0x34372FA0 is 488 bytes inside a
block of size 500 alloc'd
==26429== at 0x3414955C: malloc
(vg_replace_malloc.c:131)
==26429== by 0x8048780: main (in
/home/msadasiv/projects/valit/prgs/nls_memcpy_bug/mc)
The error doesnot occur if
- the memcpy size is changed to <= 495 ( or
100,200,300,400)
- debug compilation of the code
- gcc compiler is used (with or without debug
compilation)
$ cat /proc/version
Linux version 2.4.21-27.ELsmp
(bhc...@bu...) (gcc version 3.2.3 2
0030502 (Red Hat Linux 3.2.3-47)) #1 SMP Wed Dec 1
21:59:02 EST 2004
Smile.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|