|
From: Heiko G. <hg...@te...> - 2003-09-23 15:07:07
|
Hi,
I have a question concerning uninitialised memory on GNU/Linux. Valgrind
tells me a databuffer is uninitialised although the databuffer contains
the correct data. How can that be? I thought uninitialized means random
data.
This is what happens:
==================
I'm using the db2 CLI to retrieve data from a db2 database. Valgrind
(20030725) detects the following:
==2671== Conditional jump or move depends on uninitialised value(s)
==2671== at 0x40020840: strncpy (in usr/lib/valgrind/vgskin_memcheck.so)
==2671== by 0x408BA52B: stringcopy (string2.c:159)
==2671== by 0x408DF7B6: AtaqDBColumn::setUnchanged(unsigned, unsigned)
(ataqdb.cpp:2315)
This happens after a sql select when the db2 CLI copies data from database
colums to the bound buffers (which are definitly initialized!) in my c++
program. After filling these buffers by the db2 routines in the db2.so, in
one particular char column the 8th byte is uninitialized according to
valgrind (if I set this byte before the strncpy above is reached, valgrind
does not complain anymore).
Anyway the content of the data is absolute correct including the 8th byte.
What ever happens in the db2.so, if the ("uninitialized") byte contains the
right data how can it be uninitialized? Somehow the data must have been
copied there. There are no messages concerning invalid memory access or
similar.
Any hints?
Thanks
Heiko
|