cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Segmentation fault in SCO Unixware with libcurl,why?

From: 黄志军 <hzhijun_at_huawei.com>
Date: Thu, 21 Oct 2004 09:24:09 +0800

----- Original Message -----
From: "Daniel Stenberg" <daniel-curl_at_haxx.se>
To: "libcurl development" <curl-library_at_cool.haxx.se>
Sent: Wednesday, October 20, 2004 4:41 PM
Subject: Re: Segmentation fault in SCO Unixware with libcurl,why?

> On Wed, 20 Oct 2004, [utf-8] ??? wrote:
>
> > I made some test and found that if there is a repsonse message from the http
> > server, whether it is a normal response or a abnormal repsonse, the httpget
> > program will sure core dump.
>
> Did you build with some kind of optimize enabled? If so, can you rebuild
> without it? (as it could make the exact source file and line number get
> displayed wrong when doing the analysis of the core)

my build cmd:
configure --prefix=$HOME/tatoo --with-ssl=/home/wangxu/tatoo/FREE_LIB --disable-ipv6
i only enable ssl support.

> The stack trace of the core dump shows the crash point to be the source line
> where libcurl calls strncasecmp() with reasonable arguments.
>
> If that really is the point where the program crashes, then it looks like your
> libc is bad or something. That's why I asked for an explanation.
I build the following program with gcc and it works fine with strncasecmp
#include <stdio.h>
int curl_strnequal(const char *first, const char *second, size_t max)
{
    printf("enter1\n");
    printf("enter2\n");
    return !strncasecmp(first, second, max);
}

int main()
{
    const char * first = "--";
    const char * second = "http://10.71.115.69";
    int max = 0;
    int ret = 0;
    max = strlen(first);
    ret = curl_strnequal(first, second, max);
    printf("ret = %d\n", ret );
    return 0;
}
>
> I assume the curl tool crashes the same way on the same URL? If not, the
> problem is more likely to be in your program than in libcurl.
>
yeah, curl tool also crashes at the same way.
i execute the following:
  <230 fep01.fep01 [wangxu] :/home/wangxu/tatoo/bin> curl http://10.71.115.69

Program received signal SIGSEGV, Segmentation fault.
0xbff2e030 in _s_port_lock () from /home/wangxu/tatoo/lib/libcurl.so.3
(gdb) where
#0 0xbff2e030 in _s_port_lock () from /home/wangxu/tatoo/lib/libcurl.so.3
#1 0xbff4ec5e in curl_strnequal (first=0x80479a8 "", second=0x8047c10 "http://10.71.115.69", max=2) at strequal.c:59
#2 0x804cf1b in operate (config=0x80479a8, argc=2, argv=0x8047b1c) at main.c:2767
#3 0x804eb91 in main (argc=2147483647, argv=0x80479a8) at main.c:3575
> --
> Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
> Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-10-21