components/php-5_2/php-sapi/patches/08_php_perf_safe_address.patch
branchs11-update
changeset 4411 45579acd1602
parent 4407 7591b44b7398
child 4413 ac7688ac96e0
--- a/components/php-5_2/php-sapi/patches/08_php_perf_safe_address.patch	Wed Jun 03 06:46:31 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-Index: php-5.2.11/Zend/zend_alloc.c
-===================================================================
---- php-5.2.11/Zend/zend_alloc.c	(revision 291097)
-+++ php-5.2.11/Zend/zend_alloc.c	(working copy)
-@@ -87,6 +87,20 @@
- # define UNEXPECTED(condition) (condition)
- #endif
- 
-+#define HAVE_ZEND_LONG64
-+#ifdef ZEND_WIN32
-+typedef __int64 zend_long64;
-+typedef unsigned __int64 zend_ulong64;
-+#elif SIZEOF_LONG_LONG_INT == 8
-+typedef long long int zend_long64;
-+typedef unsigned long long int zend_ulong64;
-+#elif SIZEOF_LONG_LONG == 8
-+typedef long long zend_long64;
-+typedef unsigned long long zend_ulong64;
-+#else
-+# undef HAVE_ZEND_LONG64
-+#endif
-+
- static void zend_mm_panic(const char *message)
- {
- 	fprintf(stderr, "%s\n", message);
-@@ -2369,6 +2383,19 @@
-         return res;
- }
- 
-+#elif SIZEOF_SIZE_T == 4 && defined(HAVE_ZEND_LONG64)
-+
-+static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
-+{
-+	zend_ulong64 res = (zend_ulong64)nmemb * (zend_ulong64)size + (zend_ulong64)offset;
-+
-+	if (UNEXPECTED(res > (zend_ulong64)0xFFFFFFFFL)) {
-+		zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
-+		return 0;
-+	}
-+	return (size_t) res;
-+}
-+
- #else
- 
- static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)