RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend_execute.c php-src NEWS
| From: | Dmitry Stogov | Date: | Tue, 03 Jan 2006 15:49:44 +0000 |
| Subject: | RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend_execute.c php-src NEWS | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4499@lists.php.net to get a copy of this message | ||
Hi Marcus,
I think your suggestion (1) is right. (I'm repeating - your old fix didn't
fix the crash)
Exactly for this bug SimpleXML should return proxy object or
EG(uninitialized_zval) in case if it allows assignment or EG(error_zval) or
NULL in case of disallowing.
However ZE isn't ready to support EG(error_zval) and NULL everywhere and
should be improved.
I am on long holidays now and I'll able to look careful into you suggestion
only after January 10.
Please, look into the problem if you'll have time before.
Thanks. Dmitry.
> -----Original Message-----
> From: Marcus Boerger [mailto:helly@php.net]
> Sent: Saturday, December 31, 2005 11:29 PM
> To: Andi Gutmans
> Cc: Dmitry Stogov; zend-engine-cvs@lists.php.net; Zeev Suraski
> Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /
> zend_execute.c php-src NEWS
>
>
> Hello Andi,
>
> what ever you say...we first have to fix the engine, right
> now we handle refcount=0 in case the return_value is not used
> and correctly destroy the thing:
> ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper,
> VAR|UNUSED|CV, CONST|TMP|VAR|CV, int type) [...]
> /* here we are sure we are dealing with an object */
> *retval =
> Z_OBJ_HT_P(container)->read_property(container, offset, type
> TSRMLS_CC);
>
> if (RETURN_VALUE_UNUSED(&opline->result) &&
> ((*retval)->refcount == 0)) {
> zval_dtor(*retval);
> FREE_ZVAL(*retval);
> } else {
> SELECTIVE_PZVAL_LOCK(*retval,
> &opline->result);
> AI_USE_PTR(EX_T(opline->result.u.var).var);
> }
>
> if (IS_OP2_TMP_FREE()) {
> zval_ptr_dtor(&offset);
> } else {
> FREE_OP2();
> }
> Unfortunatley the api does not allow to signal failure in any
> way. Thus the extension does the only logical thing. It
> returns zero refcounted NULL - which is partly handled
> correct. We can now do four things:
> 1) allow to return NULL-zval* from the handler
> 2) fix all the instances where the zero refcounted thing can get
> 3) change the signature of the handler
> 4) Go with my 'fix' and find out where it really has issues
> (more or less
> same as (2)
>
> regards
> marcus
>
> Tuesday, December 27, 2005, 8:16:53 PM, you wrote:
>
> > Yep, I agree with Dmitry. The fact that he's not fixing SimpleXML,
> > doesn't mean we should allow the wrong fix in the engine.
> > If you don't have time to fix SimpleXML we can possibly find a
> > volunteer like Rob?
>
> > Andi
>
> > At 03:39 AM 12/26/2005, Dmitry Stogov wrote:
> >>Hi Marcus,
> >>
> >>Your fix didn't work.
> >>Probably it fixed crash without zend memory manager, but real error
> >>occurs before control is reached your fix. I had SIGSEGV with your
> >>fix.
> >>
> >>The problem is:
> >>
> >>$xml->bla-props[0]->name = 0;
> >>
> >>For nonexisting element "props" simplexml returns NULL with
> refcount
> >>== 0; Then ZE trying to assign dimension into it; It converts NULL
> >>into array; inserts uninitialized zval into it (for index 0);
> >>stores zval** for next opcode
> >>Then it destroys array, because refcount is 0 (this 0 comes
> from simplexml)
> >>
> >>Next opcode crashes because stored zval** is destroyed
> together with
> >>array.
> >>
> >>
> >>This bug must be fixed in ext/simplexml.
> >>It must care about "type" argument of read_property() callback and
> >>implement implicit element/attribute creation or prohibit it. ZE
> >>cannot handle such assignment automatic. (It uses
> get_zval_ptr_ptr()
> >>for that, but simplexml doesn't define it).
> >>
> >>Marcus, I don't think the fact that I rejected your patch is a good
> >>reason to re-assign this bug to me. I am not a simplexml maintainer
> >>and don't know a lot about it internals.
> >>
> >>Thanks. Dmitry.
> >>
> >>
> >> > -----Original Message-----
> >> > From: Marcus Boerger [mailto:helly@php.net]
> >> > Sent: Monday, December 26, 2005 2:07 PM
> >> > To: Dmitry Stogov
> >> > Cc: zend-engine-cvs@lists.php.net
> >> > Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /
> >> > zend_execute.c php-src NEWS
> >> >
> >> >
> >> > Hello Dmitry,
> >> >
> >> > why did you revert this fix?
> >> >
> >> > marcus
> >> >
> >> > Monday, December 26, 2005, 9:18:38 AM, you wrote:
> >> >
> >> > > dmitry Mon Dec 26 08:18:38 2005 EDT
> >> >
> >> > > Modified files: (Branch: PHP_5_1)
> >> > > /php-src NEWS
> >> > > /ZendEngine2 zend_execute.c
> >> > > Log:
> >> > > Reverted invalid fix for bug #35785
> >> > >
> >> > >
> >> > >
> >> >
> #A -`⥡PF×
> F$Dhttp://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.324&r2=1.20
> >> > 27.
> >> > > 2.325&diff_format=u
> >> > > Index: php-src/NEWS
> >> > > diff -u php-src/NEWS:1.2027.2.324 php-src/NEWS:1.2027.2.325
> >> > > --- php-src/NEWS:1.2027.2.324 Mon Dec 26 00:59:32 2005
> >> > > +++ php-src/NEWS Mon Dec 26 08:18:37 2005
> >> > > @@ -3,7 +3,6 @@
> >> > > ?? Jan 2006, PHP 5.1.2RC2
> >> > > - Fixed small leak in mysqli_stmt_fetch() when bound
> >> > variable was empty
> >> > > string. (Andrey)
> >> > > -- Fixed bug #35785 (SimpleXML causes memory read error
> >> > zend engine).
> >> > > (Marcus)
> >> > > - Fixed bug #35781 (stream_filter_append() can cause
> >> > segfault). (Tony)
> >> > > - Fixed bug #35759 (mysqli_stmt_bind_result() makes huge
> >> > allocation when
> >> > > column empty). (Andrey)
> >> > >
> >> > *�K½å
> >> > C72¨�Áhttp://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_execute.c?r1=1
> >>.716.2.8&r2=1.716.2.9&diff_format=u
> >> > Index: ZendEngine2/zend_execute.c
> >> > diff -u ZendEngine2/zend_execute.c:1.716.2.8
> >>ZendEngine2/zend_execute.c:1.716.2.9
> >> > --- ZendEngine2/zend_execute.c:1.716.2.8 Fri Dec
> 23 20:32:15 2005
> >> > +++ ZendEngine2/zend_execute.c Mon Dec 26 08:18:38 2005
> >> > @@ -17,7 +17,7 @@
> >> >
> >> >
> +-------------------------------------------------------------
> ---------+
> >> > */
> >> >
> >> > -/* $Id: zend_execute.c,v 1.716.2.8 2005/12/23 20:32:15
> helly Exp $
> >> > */
> >> > +/* $Id: zend_execute.c,v 1.716.2.9 2005/12/26 08:18:38
> dmitry Exp
> >> > +$ */
> >> >
> >> > #define ZEND_INTENSIVE_DEBUGGING 0
> >> >
> >> > @@ -548,7 +548,7 @@
> >> > make_real_object(object_ptr TSRMLS_CC); /* this should
> >> > modify
> >>object only if it's empty */
> >> > object = *object_ptr;
> >> >
> >> > - if (!object || object->type != IS_OBJECT || (opcode ==
> >> > ZEND_ASSIGN_OBJ && !Z_OBJ_HT_P(object)->write_property)) {
> >> > + if (object->type != IS_OBJECT || (opcode ==
> ZEND_ASSIGN_OBJ
> >> > + &&
> >> > !Z_OBJ_HT_P(object)->write_property)) {
> >> > zend_error(E_WARNING, "Attempt to assign
> property
> >> > of
> >>non-object");
> >> > FREE_OP(free_op2);
> >> > if (!RETURN_VALUE_UNUSED(result)) {
> >>
> >>
> >>
> >>
> >>Best regards,
> >> Marcus
> >>
> >>--
> >>Zend Engine CVS Mailing List (http://cvs.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> Best regards,
> Marcus
>
> --
> Zend Engine CVS Mailing List (http://cvs.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>