|
|
af9dc8 |
From 3c925b18fa96043e5d7e86f9ce544b143c3c2079 Mon Sep 17 00:00:00 2001
|
|
|
af9dc8 |
From: Remi Collet <remi@php.net>
|
|
|
af9dc8 |
Date: Mon, 27 Oct 2014 07:45:34 +0100
|
|
|
af9dc8 |
Subject: [PATCH] Fix bug #63595 GMP memory management conflicts with other
|
|
|
af9dc8 |
libraries using GMP
|
|
|
af9dc8 |
|
|
|
af9dc8 |
Drop use of php memory allocators as this raise various conflicts
|
|
|
af9dc8 |
with other extensions and libraries which use libgmp.
|
|
|
af9dc8 |
|
|
|
af9dc8 |
No other solution found.
|
|
|
af9dc8 |
We cannot for ensure correct use of allocator with shared lib.
|
|
|
af9dc8 |
|
|
|
af9dc8 |
Some memory can allocated before php init
|
|
|
af9dc8 |
Some memory can be freed after php shutdown
|
|
|
af9dc8 |
|
|
|
af9dc8 |
Known broken run cases
|
|
|
af9dc8 |
- php + curl + gnutls + gmp
|
|
|
af9dc8 |
- mod_gnutls + mod_php + gnutls + gmp
|
|
|
af9dc8 |
- php + freetds + gnutls + gmp
|
|
|
af9dc8 |
- php + odbc + freetds + gnutls + gmp
|
|
|
af9dc8 |
- php + php-mapi (zarafa) + gnutls + gmp
|
|
|
af9dc8 |
---
|
|
|
af9dc8 |
ext/gmp/gmp.c | 26 --------------------------
|
|
|
af9dc8 |
1 file changed, 26 deletions(-)
|
|
|
af9dc8 |
|
|
|
af9dc8 |
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
|
|
|
af9dc8 |
index f51bd8c..b1553fa 100644
|
|
|
af9dc8 |
--- a/ext/gmp/gmp.c
|
|
|
af9dc8 |
+++ b/ext/gmp/gmp.c
|
|
|
af9dc8 |
@@ -324,30 +324,6 @@ static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
|
|
af9dc8 |
# define MAX_BASE 36
|
|
|
af9dc8 |
#endif
|
|
|
af9dc8 |
|
|
|
af9dc8 |
-/* {{{ gmp_emalloc
|
|
|
af9dc8 |
- */
|
|
|
af9dc8 |
-static void *gmp_emalloc(size_t size)
|
|
|
af9dc8 |
-{
|
|
|
af9dc8 |
- return emalloc(size);
|
|
|
af9dc8 |
-}
|
|
|
af9dc8 |
-/* }}} */
|
|
|
af9dc8 |
-
|
|
|
af9dc8 |
-/* {{{ gmp_erealloc
|
|
|
af9dc8 |
- */
|
|
|
af9dc8 |
-static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
|
|
|
af9dc8 |
-{
|
|
|
af9dc8 |
- return erealloc(ptr, new_size);
|
|
|
af9dc8 |
-}
|
|
|
af9dc8 |
-/* }}} */
|
|
|
af9dc8 |
-
|
|
|
af9dc8 |
-/* {{{ gmp_efree
|
|
|
af9dc8 |
- */
|
|
|
af9dc8 |
-static void gmp_efree(void *ptr, size_t size)
|
|
|
af9dc8 |
-{
|
|
|
af9dc8 |
- efree(ptr);
|
|
|
af9dc8 |
-}
|
|
|
af9dc8 |
-/* }}} */
|
|
|
af9dc8 |
-
|
|
|
af9dc8 |
/* {{{ ZEND_GINIT_FUNCTION
|
|
|
af9dc8 |
*/
|
|
|
af9dc8 |
static ZEND_GINIT_FUNCTION(gmp)
|
|
|
af9dc8 |
@@ -369,8 +345,6 @@ ZEND_MODULE_STARTUP_D(gmp)
|
|
|
af9dc8 |
#endif
|
|
|
af9dc8 |
REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | CONST_PERSISTENT);
|
|
|
af9dc8 |
|
|
|
af9dc8 |
- mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
|
|
|
af9dc8 |
-
|
|
|
af9dc8 |
return SUCCESS;
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
/* }}} */
|
|
|
af9dc8 |
--
|
|
|
af9dc8 |
2.1.4
|
|
|
af9dc8 |
|