cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-681867 ] uninitialised values when downloading certain web pages

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 06 Feb 2003 11:22:01 -0800

Bugs item #681867, was opened at 2003-02-06 11:22
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=681867&group_id=976

Category: libcurl
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: uninitialised values when downloading certain web pages

Initial Comment:
I'm writing a web crawler and using libcurl 7.10.3. I
believe I've discovered a bug in libcurl while
debugging my application with
valgrind 1.04

I developed a simple C++ program to fetch robots.txt
from a site, parse it and store the information. I've
found that the following errors are reported by
valgrind when I try fetching robots.txt from
www.yahoo.com, which does not contain a robots.txt at
least not in the correct place.
I've attached my application it is very small and not
the web crawler just a simple test case for it.
However, if you run it with valgrind and try retrieving
a page from www.yahoo.com you should get the print out
below. Although if you try www.cnn.com you will not.

(14:15:28) taf2cs: orwell~/proj/testing/curl_test:>
valgrind ./get_test
==8026== Memcheck, a.k.a. Valgrind, a memory error
detector for x86-linux.
==8026== Copyright (C) 2002, and GNU GPL'd, by Julian
Seward.
==8026== Using valgrind-1.9.2, a program
instrumentation system for x86-linux.
==8026== Copyright (C) 2000-2002, and GNU GPL'd, by
Julian Seward.
==8026== Estimated CPU clock rate is 848 MHz
==8026== For more details, rerun with: -v
==8026==
==8026== Conditional jump or move depends on
uninitialised value(s)
==8026== at 0x4139205C: getanswer_r (in
/lib/libnss_dns-2.2.93.so)
==8026== by 0x41391003: _nss_dns_gethostbyname2_r
(in /lib/libnss_dns-2.2.93.so)
==8026== by 0x413921E2: _nss_dns_gethostbyname_r (in
/lib/libnss_dns-2.2.93.so)
==8026== by 0x420EE0C7: gethostbyname_r@@GLIBC_2.1.2
(in /lib/i686/libc-2.2.93.so)
==8026==
==8026== Conditional jump or move depends on
uninitialised value(s)
==8026== at 0x41392062: getanswer_r (in
/lib/libnss_dns-2.2.93.so)
==8026== by 0x41391003: _nss_dns_gethostbyname2_r
(in /lib/libnss_dns-2.2.93.so)
==8026== by 0x413921E2: _nss_dns_gethostbyname_r (in
/lib/libnss_dns-2.2.93.so)
==8026== by 0x420EE0C7: gethostbyname_r@@GLIBC_2.1.2
(in /lib/i686/libc-2.2.93.so)
http://www.yahoo.comdownloaded 30262 bytes
==8026==
==8026== ERROR SUMMARY: 4 errors from 2 contexts
(suppressed: 10 from 1)
==8026== malloc/free: in use at exit: 8671 bytes in 32
blocks.
==8026== malloc/free: 168 allocs, 136 frees, 170708
bytes allocated.
==8026== For a detailed leak analysis, rerun with:
--leak-check=yes
==8026== For counts of detected errors, rerun with: -v
orwell~/proj/testing/curl_test:>

when i rerun valgrind with --gdb-attach=yes and check
the state of the stack you can see the errors look like
they're coming from the system.

(14:16:30) taf2cs: #2 0x4139205c in getanswer_r ()
from /lib/libnss_dns.so.2
#3 0x41391004 in _nss_dns_gethostbyname2_r () from
/lib/libnss_dns.so.2
#4 0x413921e3 in _nss_dns_gethostbyname_r () from
/lib/libnss_dns.so.2
#5 0x420ee0c8 in gethostbyname_r@@GLIBC_2.1.2 () from
/lib/i686/libc.so.6
#6 0x4021409d in Curl_freeaddrinfo () from
/usr/lib/libcurl.so.2
#7 0x40213e1b in Curl_resolv () from /usr/lib/libcurl.so.2
#8 0x4021f1df in Curl_protocol_connect () from
/usr/lib/libcurl.so.2
#9 0x4021f611 in Curl_connect () from
/usr/lib/libcurl.so.2
#10 0x40227d0d in Curl_perform () from
/usr/lib/libcurl.so.2
#11 0x4022815f in curl_easy_perform () from
/usr/lib/libcurl.so.2
#12 0x08048f21 in HttpGet::get() ()
#13 0x08048fbb in print_get(char const*) ()
#14 0x080490a9 in main ()
#15 0x420158d4 in __libc_start_main () from
/lib/i686/libc.so.6

I hope this information will be useful...
I've attached my test program, it should compile with
gcc3.2

-Todd

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=681867&group_id=976

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
Received on 2003-02-06