cvs: ZendEngine2 / zend_operators.h php-src/ext/standard/tests/strings explode_bug.phpt

"Stanislav Malyshev" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsstas1217971400@cvsserver>
stas		Tue Aug  5 21:23:20 2008 UTC

  Modified files:              
    /php-src/ext/standard/tests/strings	explode_bug.phpt 
    /ZendEngine2	zend_operators.h 
  Log:
  fix memnstr bug by Laurent Gaffie
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/explode_bug.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/explode_bug.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/explode_bug.phpt:1.2
--- /dev/null	Tue Aug  5 21:23:20 2008
+++ php-src/ext/standard/tests/strings/explode_bug.phpt	Tue Aug  5 21:23:20 2008
@@ -0,0 +1,15 @@
+--TEST--
+Explode/memnstr bug
+--INI--
+error_reporting=2047
+memory_limit=256M
+--FILE--
+<?php
+$res = explode(str_repeat("A",145999999),1);
+var_dump($res);
+?>
+--EXPECTF--
+array(1) {
+  [0]=>
+  string(1) "1"
+}
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.h?r1=1.131&r2=1.132&diff_format=u
Index: ZendEngine2/zend_operators.h
diff -u ZendEngine2/zend_operators.h:1.131 ZendEngine2/zend_operators.h:1.132
--- ZendEngine2/zend_operators.h:1.131	Thu Jul 24 20:38:43 2008
+++ ZendEngine2/zend_operators.h	Tue Aug  5 21:23:20 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_operators.h,v 1.131 2008/07/24 20:38:43 moriyoshi Exp $ */
+/* $Id: zend_operators.h,v 1.132 2008/08/05 21:23:20 stas Exp $ */
 
 #ifndef ZEND_OPERATORS_H
 #define ZEND_OPERATORS_H
@@ -234,6 +234,9 @@
 	if (needle_len == 1) {
 		return (char *)memchr(p, *needle, (end-p));
 	}
+	if(needle_len > end-haystack) {
+		return NULL;
+	}
 
 	end -= needle_len;
 



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.