summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-5.5.10-bug66762.patch97
-rw-r--r--php55.spec7
2 files changed, 103 insertions, 1 deletions
diff --git a/php-5.5.10-bug66762.patch b/php-5.5.10-bug66762.patch
new file mode 100644
index 0000000..f45f44f
--- /dev/null
+++ b/php-5.5.10-bug66762.patch
@@ -0,0 +1,97 @@
+diff -up ext/mysqli/mysqli_api.c.orig ext/mysqli/mysqli_api.c
+--- ext/mysqli/mysqli_api.c.orig 2014-02-05 11:00:36.000000000 +0100
++++ ext/mysqli/mysqli_api.c 2014-02-25 08:16:43.597710792 +0100
+@@ -1869,6 +1869,10 @@ PHP_FUNCTION(mysqli_prepare)
+ efree(stmt);
+ RETURN_FALSE;
+ }
++#ifndef MYSQLI_USE_MYSQLND
++ stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
++ zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
++#endif
+
+ mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
+ mysqli_resource->ptr = (void *)stmt;
+@@ -2413,6 +2417,10 @@ PHP_FUNCTION(mysqli_stmt_init)
+ efree(stmt);
+ RETURN_FALSE;
+ }
++#ifndef MYSQLI_USE_MYSQLND
++ stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
++ zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
++#endif
+
+ mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
+ mysqli_resource->status = MYSQLI_STATUS_INITIALIZED;
+diff -up ext/mysqli/mysqli.c.orig ext/mysqli/mysqli.c
+--- ext/mysqli/mysqli.c.orig 2014-02-05 11:00:36.000000000 +0100
++++ ext/mysqli/mysqli.c 2014-02-25 08:21:37.336860837 +0100
+@@ -176,8 +176,11 @@ void php_clear_stmt_bind(MY_STMT *stmt T
+ php_free_stmt_bind_buffer(stmt->param, FETCH_SIMPLE);
+ /* Clean output bind */
+ php_free_stmt_bind_buffer(stmt->result, FETCH_RESULT);
+-#endif
+
++ if (stmt->link_handle) {
++ zend_objects_store_del_ref_by_handle(stmt->link_handle TSRMLS_CC);
++ }
++#endif
+ if (stmt->query) {
+ efree(stmt->query);
+ }
+@@ -1069,6 +1072,10 @@ PHP_FUNCTION(mysqli_stmt_construct)
+ efree(stmt);
+ RETURN_FALSE;
+ }
++#ifndef MYSQLI_USE_MYSQLND
++ stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
++ zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
++#endif
+
+ mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
+ mysqli_resource->ptr = (void *)stmt;
+diff -up ext/mysqli/php_mysqli_structs.h.orig ext/mysqli/php_mysqli_structs.h
+--- ext/mysqli/php_mysqli_structs.h.orig 2014-02-05 11:00:36.000000000 +0100
++++ ext/mysqli/php_mysqli_structs.h 2014-02-25 08:16:43.598710795 +0100
+@@ -116,6 +116,10 @@ typedef struct {
+ BIND_BUFFER param;
+ BIND_BUFFER result;
+ char *query;
++#ifndef MYSQLI_USE_MYSQLND
++ /* used to manage refcount with libmysql (already implement in mysqlnd) */
++ zend_object_handle link_handle;
++#endif
+ } MY_STMT;
+
+ typedef struct {
+diff -up ext/mysqli/tests/bug66762.phpt.orig ext/mysqli/tests/bug66762.phpt
+--- ext/mysqli/tests/bug66762.phpt.orig 2014-02-25 08:16:17.118619251 +0100
++++ ext/mysqli/tests/bug66762.phpt 2014-02-25 08:31:33.252385139 +0100
+@@ -0,0 +1,26 @@
++--TEST--
++Bug #66762 mysqli@libmysql segfault in mysqli_stmt::bind_result() when link closed
++--SKIPIF--
++<?php
++require_once('skipif.inc');
++require_once('skipifconnectfailure.inc');
++?>
++--FILE--
++<?php
++ require_once("connect.inc");
++
++ $mysqli = new mysqli($host, $user, $passwd, $db);
++
++ $read_stmt = $mysqli->prepare("SELECT 1");
++
++ var_dump($read_stmt->bind_result($data));
++
++ unset($mysqli);
++ var_dump($read_stmt->bind_result($data));
++
++?>
++done!
++--EXPECT--
++bool(true)
++bool(true)
++done!
+\ Pas de fin de ligne à la fin du fichier
diff --git a/php55.spec b/php55.spec
index ee2831e..943f80b 100644
--- a/php55.spec
+++ b/php55.spec
@@ -114,7 +114,7 @@ Summary: PHP scripting language for creating dynamic web sites
Name: php
Version: 5.5.10
%if 0%{?snapdate:1}%{?rcver:1}
-Release: 0.2.%{?snapdate}%{?rcver}%{?dist}
+Release: 0.3.%{?snapdate}%{?rcver}%{?dist}
%else
Release: 1%{?dist}
%endif
@@ -178,6 +178,7 @@ Patch91: php-5.3.7-oci8conf.patch
# Upstream fixes (100+)
Patch101: php-5.5.10-leak.patch
+Patch102: php-5.5.10-bug66762.patch
# Security fixes (200+)
@@ -892,6 +893,7 @@ rm -rf ext/json
# upstream patches
%patch101 -p1 -b .memleak
+%patch102 -p0 -b .66762
# security patches
@@ -1877,6 +1879,9 @@ fi
%changelog
+* Tue Feb 25 2014 Remi Collet <rcollet@redhat.com> 5.5.10-0.3.RC1
+- test build for https://bugs.php.net/66762
+
* Fri Feb 21 2014 Remi Collet <rcollet@redhat.com> 5.5.10-0.2.RC1
- another test build of 5.5.10RC1
- fix memleak in fileinfo ext