php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21479 Crashes with 6 slashes in URL and non-existant file
Submitted: 2003-01-06 20:17 UTC Modified: 2003-04-28 17:02 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: info at ofek dot com Assigned: wez (profile)
Status: Closed Package: GetImageSize related
PHP Version: 4.3.2-dev OS: Win 2000 / XP IIS (CGI)
Private report: No CVE-ID: None
 [2003-01-06 20:17 UTC] info at ofek dot com
function ImgExists($f) {
  $r=@getimagesize("http://localhost/$f");
  return $r[2]!=0;
}
if(ImgExists('icon.jpg')) echo('exists!');


when calling this function, php.exe (4.3.0 as CGI in IIS4) is crashing. remark out the 'getimagesize' line, and it won't crash.

i can email my php.ini on request.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-22 22:58 UTC] info at ofek dot com
HOLD IT - I just found out exactly how to reproduce it. please read carefully.

the code is:
<?php
function ImageExists($url) {
  $r=@getimagesize($url);
  return $r[2]!=0;
}
echo ImageExists('http://domain/dir1/dir2/dir3/image.gif');
?>

make sure the path:
http://domain/dir1/dir2/dir3/
containts THREE directories after the domain (i.e. 6 forward-slashes total), and that the PATH physically EXISTS.

AND make sure that the file (in code 'image.gif') DOES NOT exist.

You can test against:
http://economads.com/libaware/_font/title/image.gif

This crashes on my server - running PHP 4.3.0 as CGI with IIS Win2000. 

Hope this helps.
 [2003-02-19 23:12 UTC] sniper@php.net
I finally got around installing PHP to my windows (2k) machine and could reproduce this crash.

This is the error I get (as expected):
..function.getimagesize: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in...

But it also popups that windows error about '..generated errors..blabla..'.

It happens only with longer urls it seems. The one in
above comment does not cause the crash for me.

Seems like some oddity with the streams stuff, assigning to Wez. :)


 [2003-02-20 01:10 UTC] info at ofek dot com
i only get the GPF crash, no messages.. i hope you reproduced the same bug. also since the script in the second comment does crash on my system. we'll see - just tell me when a dev version is ready.
 [2003-02-21 04:26 UTC] sniper@php.net
Now I can not reproduce this anymore using the given location. (with latest snapshot)


 [2003-02-22 04:59 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

A number of fixes went into CVS last night; it is quite possible that this problem is fixed (we've had a good response so far).
Please try a stable snapshot.
 [2003-02-23 12:42 UTC] info at ofek dot com
ok i tried it (unzipped into a new dir and rebooted) and it still crashes, just with different hex addresses in the GPF message.
 [2003-02-23 17:48 UTC] sniper@php.net
I doesn't crash for me anymore using this script:

<?php var_dump(getimagesize('http://economads.com/libaware/_font/title/image.gif')); ?>

Can you verify that this exact script causes the crash?
And if so, could you also test this on some other machine too?


 [2003-03-01 18:27 UTC] info at ofek dot com
that script you posted doesn't crash on my system either - but this one does:

function ImageExists($url) {
  $r=@getimagesize($url);
  return $r[2]!=0;
}
echo ImageExists('http://economads.com/libaware/_font/title/123456.gif');

it's funny, if the file name is 12345.gif it doesn't crash, but if it's 123456.gif than it does!
 [2003-03-04 19:25 UTC] sniper@php.net
Are you using the latest CVS snapshot? (if not get it)

 [2003-03-05 01:40 UTC] info at ofek dot com
i downloaded the 4.3.x snapshot quite a few times, and i can try again - but do you mean i should try the 5.0.x snapshot?
 [2003-03-18 12:19 UTC] wez@php.net
I can't reproduce this problem either, under winxp.
Could you try the latest stable snapshot again?

If it crashes, please paste here the error message that you are seing, along with the date/time of the snapshot that you tried.
 [2003-03-20 14:39 UTC] info at ofek dot com
i have windows 2000 pro not XP.
it still crashes with the latest stable snapshot:
php4-win32-STABLE-200303201730.zip

the error message dialog can be found here:

http://ofek.com/ebimg/1.gif
 [2003-04-16 10:33 UTC] info at ofek dot com
ok, i just got a new machine, and installed Windows XP Pro this time with the latest stable php 4.3.1 - still crashing! this code won't run!
 [2003-04-28 08:11 UTC] wez@php.net
Make sure you try the snapshot and not 4.3.1?

I really can't reproduce it here.  It is possibly related to some other memory corruption elsewhere (another recently reported bug); I'm keeping this open for now, until we track down the problem with the other bug.
 [2003-04-28 08:12 UTC] wez@php.net
What extensions do you have loaded?
Can you put your phpinfo() output somewhere that we can see it online?
 [2003-04-28 09:48 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I've just fixed a bug in fopen() of http:// urls; this will most likely fix your problem here.

Please try the *next* snapshot (the fix has only just gone into CVS).

Next STABLE Win32 snapshot in: 1 hour(s) and 28 minute(s)

 [2003-04-28 16:59 UTC] info at ofek dot com
downloaded the last snapshot, and it looks like it is fixed! thanks. is this fix going to be part of 4.3.2 and do you know when it's due out? 
thank you for your efforts.
 [2003-04-28 17:02 UTC] moriyoshi@php.net
The fix will be in 4.3.2 as well.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC