cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-499969 ] crash on not-followed Location: redirect

From: <noreply_at_sourceforge.net>
Date: Sat, 05 Jan 2002 13:36:03 -0800

Bugs item #499969, was opened at 2002-01-05 13:36
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=499969&group_id=976

Category: libcurl
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: crash on not-followed Location: redirect

Initial Comment:

sparc/Solaris 5.8, php-4.1.1, apache-1.3.22, and curl-
7.9.2

My apologies in advance if this is actually a problem with
PHP, but the symptoms seem too specific to libcurl.

With this
PHP code:

  $ch = curl_init();
  curl_setopt ($ch,
CURLOPT_URL, "http://us.imdb.com/Find");
  curl_setopt ($ch,
CURLOPT_POST, 1);
  curl_setopt ($ch, CURLOPT_POSTFIELDS,
"select=Titles&for=$title");
  curl_setopt ($ch,
CURLOPT_USERAGENT, "DataFetch");
  curl_setopt ($ch,
CURLOPT_HEADER, 0);
  curl_setopt ($ch,
CURLOPT_RETURNTRANSFER, 1);
  $result = curl_exec ($ch);
  
curl_close ($ch);

The IMDB will return a Location: directive
if it matches only one item for "$title" - "zing" is an example that
causes this right now.

I can add this and there is no
problem:

  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION,
1);

The problem also goes away if I remove RETURNTRANSFER, but
that's a much less useful solution =)

But the apache process
dies with segmentation fault without that option on.

I can
truss apache and get this output:

send(6, " P O S T / F i n d H"..,
245, 0) = 245
poll(0xEFFFD588, 1, 1000) = 1
recv(6, " H T T P / 1 . 1 3 0
2".., 51199, 0) = 267
close(6) = 0
sigaction(SIGPIPE,
0xEFFFD818, 0xEFFFD898) = 0
    Incurred fault #6, FLTBOUNDS %pc =
0xEF4B3C98
      siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000
    
Received signal #11, SIGSEGV [caught]
      siginfo: SIGSEGV
SEGV_MAPERR addr=0x00000000
chdir("/usr/local/apache") =
0
sigaction(SIGSEGV, 0xEFFFD610, 0xEFFFD690) = 0
getpid() =
10504 [24603]
kill(10504, SIGSEGV) =
0
setcontext(0xEFFFD810)
    Received signal #11, SIGSEGV
[default]
      siginfo: SIGSEGV pid=10504 uid=60001
        *** process
killed ***

Apache dutifully reports:

[Sat Jan 5 13:57:02
2002] [notice] child pid 13089 exit signal Segmentation Fault
(11)

A snoop of the session shows:

0000520 326 242 365 3 " 324
P 030 ` 364 224 : \0 \0 P O
0000540 S T / F i n d H T T P / 1 .
0000560 1 \r \n U s
e r - A g e n t : D
0000600 a t a F e t c h N X \r \n H o s
0000620 t : u s . i m d b . c o m
\r \n
0000640 P r a g m a : n o - c a c h e
0000660 \r \n A c c e p t : i m a g e
/
0000700 g i f , i m a g e / x - x b i
0000720 t m a p , i m a g e / j p e g
0000740
, i m a g e / p j p e g , *
0000760 / * \r \n C o n t e n t - L e n g
0001000 t h : 2 2 \r
\n C o n t e n t -
0001020 T y p e : a p p l i c a t i o
0001040 n / x - w w w - f o r m - u r
l
0001060 e n c o d e d \r \n \r \n s e l e c
0001100 t = T i t l e s & f o r = z i
n
0001120 g \r \n 375 \0 \0 \0 < \0 \0 \0 < \0 \0 \0 T
0001140 \0 \0 \0 \0 <
7 h 236 \0 002 262 256 \b \0 301
0001160 243 255 \0 340 320 \0 227 . \b \0 E
\0 \0 ( 357 353
0001200 @ \0 1 006 274 ~ 317 253 250 024 330 W M N \0
P
0001220 206 8 365 3 " 324 : 260 327 227 P 020 031 H v
0001240 \0 \0 \0
\0 \0 \0 \0 \0 \0 \0 001 A \0 \0 001 A
0001260 \0 \0 001 \ \0 \0 \0 \0 < 7 h 236
\0 003 204 :
0001300 \b \0 301 243 255 \0 340 320 \0 227 . \b \0 E
\0
0001320 001 3 357 354 @ \0 1 006 273 r 317 253 250 024 330 W
0001340
M N \0 P 206 8 365 3 " 324 : 260 327 227 P 030
0001360 031 b 006 \0 \0 H T T P / 1
. 1 3
0001400 0 2 F o u n d \r \n D a t e :
0001420 S a t , 0 5 J a n 2 0 0
2
0001440 2 0 : 5 7 : 3 5 G M T \r \n S
0001460 e r v e r : A p a c h e / 1
Received on 2002-01-05