You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2019/02/22 11:21:36 UTC

[thrift] branch master updated: THRIFT-4807: Fix php segfault on reference pass

This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new a4ee1f2  THRIFT-4807: Fix php segfault on reference pass
a4ee1f2 is described below

commit a4ee1f281bc4ec4b08efe3a5b3408738d7f9f516
Author: Josip Sokcevic <in...@sokac.net>
AuthorDate: Wed Feb 20 23:15:08 2019 -0800

    THRIFT-4807: Fix php segfault on reference pass
    
    Client: php (extension)
    
    When reference is passed to php extension, it's unreferenced (instead of
    derefrenced). The next time one tries to use the same variable PHP
    segaults. Even if not used again, php segfaults on
    user_shutdown_function_call.
---
 lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
index 63c8905..e152d08 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
@@ -1013,7 +1013,7 @@ void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable
     zval* prop = zend_read_property(Z_OBJCE_P(zthis), zthis, varname, strlen(varname), false, &rv);
 
     if (Z_TYPE_P(prop) == IS_REFERENCE){
-      ZVAL_UNREF(prop);
+      ZVAL_DEREF(prop);
     }
     if (Z_TYPE_P(prop) != IS_NULL) {
       transport.writeI8(ttype);