php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13641 Erroneous code makes PHP.EXE crash
Submitted: 2001-10-11 06:42 UTC Modified: 2001-11-19 16:05 UTC
From: rune at strand dot gs Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.0.6 OS: Win32 (W2K)
Private report: No CVE-ID: None
 [2001-10-11 06:42 UTC] rune at strand dot gs
<code>
<?php $str = "this is text"; $var = strtok($str); echo ?>
</code>

I know the code is wrong, but php.exe shouldn't crash.
I've got the Standard binary distribution for Win32 running as CGI binary from the standard Apache binary distribution.

W2K error message:
"php-exe - Application Error
The instruction at 0x1004cbb3" referenced memory at 0x5b0a0d0a". The memory could not be 'read'. Click OK to terminate the program"

Sorry; no gdb backtrace...

Thanks for doing great work!
--rune

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-11 06:48 UTC] derick@php.net
FYI: I could not reproduce this with Linux/4.0.6.
 [2001-10-12 06:47 UTC] sander@php.net
Reproduced with PHP-4.0.6 on Win98.

You can even simplify the code: 
<?php strtok('foo'); ?>

The problem is that you may not call strtok the first time without the second argument. If you do, it will crash, no matter what the first argument is.

This should really be fixed before 4.0.7 comes out (if it's not already fixed in CVS, I can't test it right now).
 [2001-10-12 06:50 UTC] mfischer@php.net
FYI: couldn't reproduce with current CVS under W2K
 [2001-10-12 06:50 UTC] derick@php.net
Marked as critcal, and checking this out.

Derick
 [2001-10-12 07:23 UTC] jmoore@php.net
Works fine here on Win 2k, 4.0.6 and latest CVS.

- James
 [2001-10-12 07:28 UTC] derick@php.net
There were a lot of changes to this file since PHP 4.0.6. Can you test it with a snapshot from (http://www.php4win.com/builds/latest-build.php) ?

Derick
 [2001-10-12 10:03 UTC] sander@php.net
PHP-4.0.8-dev crashes (the latest build from php4win, 2001-10-04).
PHP-4.0.7RC1 works fine. I don't have access to a more recent version of PHP-4.0.7, as I can't build Windows versions myself (yet).

Tested on Win2K.
 [2001-10-12 10:29 UTC] sander@php.net
PHP-4.0.8-dev crashes (the latest build from php4win, 2001-10-04).
PHP-4.0.7RC1 works fine. I don't have access to a more recent version of PHP-4.0.7, as I can't build Windows versions myself (yet).

Tested on Win2K.
 [2001-10-12 12:06 UTC] sander@php.net
FYI: A freshly compiled 4.0.7RC3 doesn't crash either (on Win2K).
 [2001-10-15 10:51 UTC] derick@php.net
Let's not assign this to me, as I've no Windows box to test.

Derick
 [2001-11-02 20:28 UTC] jmoore@php.net
not critical
 [2001-11-19 16:05 UTC] sebastian@php.net
<?php $str = "this is text"; $var = strtok($str); echo ?>
does not crash with PHP_4_0_7 branch on Win32.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Sep 22 22:01:27 2024 UTC