cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-564585 ] redhat on alpha CPU

From: <noreply_at_sourceforge.net>
Date: Tue, 04 Jun 2002 14:04:46 -0700

Bugs item #564585, was opened at 2002-06-04 14:04
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=564585&group_id=976

Category: compile or build problem
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: redhat on alpha CPU

Initial Comment:
uname -a
Linux lx01 2.4.18-ac3 #7 SMP Fri May 3 09:33:30 PDT
2002 alpha unknown

curl -V
curl 7.9.7 (alphaev67-unknown-linux-gnu) libcurl 7.9.7
(OpenSSL 0.9.6)

curl gives several warnings when compiling hostip.c.
The resulting binary crashes in hostcache_fixoffset().
On this machine a pointer is 8 bytes and an int is only
4 bytes. Therefore I needed to change
the pointer math to use long int's.

I have a patch that seems to fix this problem... I'm
not 100% sure
the malloc(128) needs to be changed to
malloc(sizeof(struct hostent)) but it worked.

--- patch
diff hostip.c.orig hostip.c
463,464c463,464
< h->h_name=(char *)((int)h->h_name+offset);
< h->h_aliases=(char **)((int)h->h_aliases+offset);

---
>   h->h_name=(char *)((long int)h->h_name+offset);
>   h->h_aliases=(char **)((long int)h->h_aliases+offset);
466c466
<     h->h_aliases[i]=(char
*)((int)h->h_aliases[i]+offset);
---
>     h->h_aliases[i]=(char *)((long
int)h->h_aliases[i]+offset);
469c469
<   h->h_addr_list=(char **)((int)h->h_addr_list+offset);
---
>   h->h_addr_list=(char **)((long
int)h->h_addr_list+offset);
472c472
<     h->h_addr_list[i]=(char
*)((int)h->h_addr_list[i]+offset);
---
>     h->h_addr_list[i]=(char *)((long
int)h->h_addr_list[i]+offset);
499c499
<     int *buf = (int *)malloc(128);
---
>     long int *buf = (long int *)malloc(sizeof(struct
hostent));
580c580
<       offset=(int)h-(int)buf;
---
>       offset=(long int)h-(long int)buf;
--- crash location
(gdb) run http://www.yahoo.com
Starting program: curl http://www.yahoo.com
Program received signal SIGSEGV, Segmentation fault.
0x2000003af7c in hostcache_fixoffset (h=0x120054134,
offset=0) at hostip.c:465
465
  while(h->h_aliases[i]) {
(gdb) where
#0  0x2000003af7c in hostcache_fixoffset
(h=0x120054134, offset=0) at hostip.c:465
#1  0x2000003b344 in Curl_getaddrinfo
(data=0x12003ea94, hostname=0x12005397c
"www.yahoo.com", port=0, 
    bufp=0x11fffecb8) at hostip.c:581
#2  0x2000003ad18 in Curl_resolv (data=0x12003ea94,
hostname=0x12005397c "www.yahoo.com", port=80)
    at hostip.c:239
#3  0x2000004d0ac in CreateConnection
(data=0x12003ea94, in_connect=0x11ffff070) at url.c:2212
#4  0x2000004d63c in Curl_connect (data=0x12003ea94,
in_connect=0x11ffff070) at url.c:2364
#5  0x2000005de3c in Curl_perform (data=0x12003ea94) at
transfer.c:1137
#6  0x2000005eda8 in curl_easy_perform
(curl=0x12003ea94) at easy.c:245
#7  0x120007a90 in operate (config=0x11ffff4e8, argc=2,
argv=0x11ffff738) at main.c:2617
#8  0x120007f1c in main (argc=2, argv=0x11ffff738) at
main.c:2723
#9  0x2000024b0ac in __libc_start_main
(main=0x120007ec0 <main>, argc=2, ubp_av=0x11ffff738, 
    init=0x120001a08 <_init>, fini=0x2000002d738
<_dl_debug_mask>, rtld_fini=0x120054154, 
    stack_end=0x11ffff720) at
../sysdeps/generic/libc-start.c:129
--- warnings from hostip.c
rm -f .libs/hostip.lo
gcc -DHAVE_CONFIG_H -I../include -I../lib -I../lib
-DMALLOCDEBUG
-I/usr/redhat_7_a.5_31_2002/ssl//include/openssl
-I/usr/redhat_7_a.5_31_2002/ssl//include -W -Wall
-Wwrite-strings -pedantic -Wundef -Wpointer-arith
-Wcast-align -Wnested-externs -g -c hostip.c
-Wp,-MD,.deps/hostip.TPlo  -fPIC -DPIC -o .libs/hostip.lo
hostip.c: In function `hostcache_fixoffset':
hostip.c:463: warning: cast from pointer to integer of
different size
hostip.c:463: warning: cast to pointer from integer of
different size
hostip.c:464: warning: cast from pointer to integer of
different size
hostip.c:464: warning: cast to pointer from integer of
different size
hostip.c:466: warning: cast from pointer to integer of
different size
hostip.c:466: warning: cast to pointer from integer of
different size
hostip.c:469: warning: cast from pointer to integer of
different size
hostip.c:469: warning: cast to pointer from integer of
different size
hostip.c:472: warning: cast from pointer to integer of
different size
hostip.c:472: warning: cast to pointer from integer of
different size
hostip.c: In function `Curl_getaddrinfo':
hostip.c:504: warning: cast increases required
alignment of target type
hostip.c:505: warning: cast increases required
alignment of target type
hostip.c:566: warning: cast increases required
alignment of target type
hostip.c:580: warning: cast from pointer to integer of
different size
hostip.c:580: warning: cast from pointer to integer of
different size
--- Patch 
----------------------------------------------------------------------
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=564585&group_id=976
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Received on 2002-06-04