|
From: Bobby K. <rd...@kr...> - 2008-02-28 01:39:50
|
Hi!
> for (int i = 0; i < ret; ++i) {
> if (VALGRIND_CHECK_VALUE_IS_DEFINED(bufptr[nread + i]) {
> printf("Byte %d is not defined\n", nread + i);
> }
> }
I forgot to ask some more basic questions.
Does it matter if I compile on an older distro of linux running 2.4.x
and then run the program on a more modern 2.6 kernel and associated
libs and valgrind? Its dynamically linked so I was hoping that this
would not interfere with valgrind.
My english isnt so good since I'm a US resident :) But,
VALGRIND_CHECK_VALUE_IS_DEFINED returns true *if* the value is *not*
defined? Is this a correct reading of the manual?
I added the code you suggested as such:
bzero((void *)&wh,sizeof(wh)); /* make valgrind happy? */
ret = 0; nread = 0;
bufptr = (u_char *)&wh;
for (nread = 0; nread < sizeof(wh); nread += ret) {
ret = SSL_read(ssl,bufptr+nread,sizeof(wh)-nread);
if (ret <= 0)
break;
}
if (ret == 0) {
return -1;
}
if (ret < 0) {
return -1;
}
for (i=0; i<nread; i++) {
if (VALGRIND_CHECK_VALUE_IS_DEFINED(bufptr[i])) {
fprintf(stderr,
"xmpRecvMessage: byte %d of wireheader buf is not
defined\n",i);
}
}
I got the following output:
xmpRecvMessage: byte 0 of wireheader buf is not defined
xmpRecvMessage: byte 1 of wireheader buf is not defined
xmpRecvMessage: byte 2 of wireheader buf is not defined
xmpRecvMessage: byte 3 of wireheader buf is not defined
xmpRecvMessage: byte 4 of wireheader buf is not defined
xmpRecvMessage: byte 5 of wireheader buf is not defined
xmpRecvMessage: byte 6 of wireheader buf is not defined
xmpRecvMessage: byte 7 of wireheader buf is not defined
xmpRecvMessage: byte 8 of wireheader buf is not defined
xmpRecvMessage: byte 9 of wireheader buf is not defined
So, I'm wondering if valgrind is not happy with data that originated
in a network socket down in the kernel.
This would explain why valgrind goes ballistic on me and chastises me
virtually about everything else I do when I receive the PDU.
Thanks,
Bobby
|