php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11630 no check for bound of a string
Submitted: 2001-06-23 13:19 UTC Modified: 2001-06-27 11:41 UTC
From: Xuefer at 21cn dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.5 OS: win2k
Private report: No CVE-ID: None
 [2001-06-23 13:19 UTC] Xuefer at 21cn dot com
array:
$foo = array("bar");
echo $foo[0]; // correct
echo $foo[1]; // warnning

string?:
$foo = "bar"; // 0-b 1-a 3-r
echo $foo[0]; // correct
echo $foo[4]; // no warnning?


safe:
$foo = "bar"; // 0-b 1-a 3-r
echo $foo;    // all rignts
$foo[1] = "";

crash in win2k:
$foo = "bar"; // 0-b 1-a 3-r
echo $foo[0];
echo $foo[4]; // no warnning
$foo[1] = $foo[4]; // no warnning
echo $foo;    // crash! memory cannot be "written"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-23 14:37 UTC] sniper@php.net
The crash (your last example) should be fixed in CVS.

But I also think there should be a warning at least when
trying to access characters out of the string boundary.

 [2001-06-27 11:41 UTC] zeev@php.net
Fixed
Warnings added in case of a reference to an illegal offset.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 03:01:29 2024 UTC