cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug34045.phpt php-src NEWS

From: Date: Wed, 10 Aug 2005 06:37:28 +0000
Subject: cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug34045.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3979@lists.php.net to get a copy of this message
dmitry Wed Aug 10 02:37:28 2005 EDT Modified files: /php-src NEWS /ZendEngine2 zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests bug34045.phpt Log: Fixed bug #34045 (Buffer overflow with serialized object)

http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2031&r2=1.2032&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.2031 php-src/NEWS:1.2032 --- php-src/NEWS:1.2031 Tue Aug 9 16:49:12 2005 +++ php-src/NEWS Wed Aug 10 02:37:26 2005 @@ -20,6 +20,7 @@ - Fixed "make test" to work for phpized extensions. (Hartmut, Jani) - Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems. (Andrey) +- Fixed bug #34045 (Buffer overflow with serialized object). (Dmitry) - Fixed bug #33999 (object remains object when cast to int). (Dmitry) - Fixed bug #33996 (No information given for fatal error on passing invalid value to typed argument). (Dmitry) http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.59&r2=1.60&ty=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59 ZendEngine2/zend_vm_def.h:1.60 --- ZendEngine2/zend_vm_def.h:1.59 Fri Aug 5 02:29:46 2005 +++ ZendEngine2/zend_vm_def.h Wed Aug 10 02:37:26 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59 2005/08/05 06:29:46 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.60 2005/08/10 06:37:26 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1838,10 +1838,14 @@ } EG(current_execute_data) = EXECUTE_DATA; + +/* We shouldn't fix bad extensions here, + because it can break proper ones (Bug #34045) if (!EX(function_state).function->common.return_reference) { EX_T(opline->result.u.var).var.ptr->is_ref = 0; EX_T(opline->result.u.var).var.ptr->refcount = 1; } +*/ if (!return_value_used) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.62&r2=1.63&ty=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62 ZendEngine2/zend_vm_execute.h:1.63 --- ZendEngine2/zend_vm_execute.h:1.62 Fri Aug 5 02:29:46 2005 +++ ZendEngine2/zend_vm_execute.h Wed Aug 10 02:37:27 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_execute.h,v 1.62 2005/08/05 06:29:46 dmitry Exp $ */ +/* $Id: zend_vm_execute.h,v 1.63 2005/08/10 06:37:27 dmitry Exp $ */ static opcode_handler_t zend_user_opcode_handlers[256] = {(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL}; @@ -187,10 +187,14 @@ } EG(current_execute_data) = execute_data; + +/* We shouldn't fix bad extensions here, + because it can break proper ones (Bug #34045) if (!EX(function_state).function->common.return_reference) { EX_T(opline->result.u.var).var.ptr->is_ref = 0; EX_T(opline->result.u.var).var.ptr->refcount = 1; } +*/ if (!return_value_used) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } http://cvs.php.net/diff.php/ZendEngine2/tests/bug34045.phpt?r1=1.1&r2=1.2&ty=u Index: ZendEngine2/tests/bug34045.phpt diff -u /dev/null ZendEngine2/tests/bug34045.phpt:1.2 --- /dev/null Wed Aug 10 02:37:28 2005 +++ ZendEngine2/tests/bug34045.phpt Wed Aug 10 02:37:27 2005 @@ -0,0 +1,28 @@ +--TEST-- +Bug #34045 (Buffer overflow with serialized object) +--FILE-- +<?php +class BasicSingleton +{ + private static $instance; + + public function __wakeup() { + self::$instance = $this; + } + + public static function singleton() { + if (!(self::$instance instanceof BasicSingleton)) { + $c = __CLASS__; + self::$instance = new $c; + } + return self::$instance; + } +} + +$db = BasicSingleton::singleton(); +$db_str = serialize($db); +$db2 = unserialize($db_str); +echo "ok\n"; +?> +--EXPECT-- +ok
« previous php.zend-engine.cvs (#3979) next »