cvs: ZendEngine2 / zend_execute_API.c /tests bug41421.phpt
| From: | Antony Dovgal | Date: | Fri, 18 May 2007 11:51:40 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute_API.c /tests bug41421.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5805@lists.php.net to get a copy of this message | ||
tony2001 Fri May 18 11:51:40 2007 UTC
Added files:
/ZendEngine2/tests bug41421.phpt
Modified files:
/ZendEngine2 zend_execute_API.c
Log:
fix #41421 (Uncaught exception from a stream wrapper segfaults)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.400&r2=1.401&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.400 ZendEngine2/zend_execute_API.c:1.401
--- ZendEngine2/zend_execute_API.c:1.400 Fri Apr 27 08:11:37 2007
+++ ZendEngine2/zend_execute_API.c Fri May 18 11:51:40 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.400 2007/04/27 08:11:37 tony2001 Exp $ */
+/* $Id: zend_execute_API.c,v 1.401 2007/05/18 11:51:40 tony2001 Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -711,6 +711,10 @@
}
if (fci->object_pp) {
+ if (Z_TYPE_PP(fci->object_pp) == IS_OBJECT
+ && (!EG(objects_store).object_buckets ||
!EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(fci->object_pp)].valid)) {
+ return FAILURE;
+ }
/* TBI!! new object handlers */
if (Z_TYPE_PP(fci->object_pp) == IS_OBJECT) {
if (!IS_ZEND_STD_OBJECT(**fci->object_pp)) {
@@ -905,6 +909,10 @@
calling_scope = fci_cache->calling_scope;
fci->object_pp = fci_cache->object_pp;
EX(object) = fci->object_pp ? *fci->object_pp : NULL;
+ if (fci->object_pp && Z_TYPE_PP(fci->object_pp) == IS_OBJECT
+ && (!EG(objects_store).object_buckets ||
!EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(fci->object_pp)].valid)) {
+ return FAILURE;
+ }
}
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED))
{
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug41421.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug41421.phpt
+++ ZendEngine2/tests/bug41421.phpt
--TEST--
Bug #41421 (Uncaught exception from a stream wrapper segfaults)
--FILE--
<?php
class wrapper {
function stream_open() {
return true;
}
function stream_eof() {
throw new exception();
}
}
stream_wrapper_register("wrap", "wrapper");
$fp = fopen("wrap://...", "r");
feof($fp);
echo "Done\n";
?>
--EXPECTF--
Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on line %d
Fatal error: Uncaught exception 'Exception' in %s:%d
Stack trace:
#0 [internal function]: wrapper->stream_eof()
#1 %s(%d): feof(Resource id #6)
#2 {main}
thrown in %s on line %d