diff options
-rw-r--r-- | redis-pr1057.patch | 61 | ||||
-rw-r--r-- | redis-pr1063.patch | 54 | ||||
-rw-r--r-- | redis-pr1064.patch | 31 |
3 files changed, 146 insertions, 0 deletions
diff --git a/redis-pr1057.patch b/redis-pr1057.patch new file mode 100644 index 0000000..361cd9d --- /dev/null +++ b/redis-pr1057.patch @@ -0,0 +1,61 @@ +From 61c02e2985494b3de6ebbbd25f622085ca4b1103 Mon Sep 17 00:00:00 2001 +From: Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> +Date: Thu, 15 Dec 2016 15:08:17 +0200 +Subject: [PATCH] Fix segfault in testSerializerIGBinary + +--- + library.c | 14 ++++++++------ + redis.c | 6 +++--- + 2 files changed, 11 insertions(+), 9 deletions(-) + +diff --git a/library.c b/library.c +index a48fc41..4182d24 100644 +--- a/library.c ++++ b/library.c +@@ -2087,14 +2087,16 @@ redis_unserialize(RedisSock* redis_sock, const char *val, int val_len, + { + /* This is most definitely not an igbinary string, so do + not try to unserialize this as one. */ +- return 0; ++ break; + } + +- if(igbinary_unserialize((const uint8_t *)val, (size_t)val_len, +- z_ret TSRMLS_CC) == 0 +- ) { +- ret = 1; +- } ++#if (PHP_MAJOR_VERSION < 7) ++ INIT_PZVAL(z_ret); ++ ret = !igbinary_unserialize((const uint8_t *)val, (size_t)val_len, &z_ret TSRMLS_CC); ++#else ++ ret = !igbinary_unserialize((const uint8_t *)val, (size_t)val_len, z_ret TSRMLS_CC); ++#endif ++ + #endif + break; + } +diff --git a/redis.c b/redis.c +index 2b27b5f..25297d6 100644 +--- a/redis.c ++++ b/redis.c +@@ -527,6 +527,9 @@ static void add_class_constants(zend_class_entry *ce, int is_cluster TSRMLS_DC) + /* serializer */ + zend_declare_class_constant_long(ce, ZEND_STRL("SERIALIZER_NONE"), REDIS_SERIALIZER_NONE TSRMLS_CC); + zend_declare_class_constant_long(ce, ZEND_STRL("SERIALIZER_PHP"), REDIS_SERIALIZER_PHP TSRMLS_CC); ++#ifdef HAVE_REDIS_IGBINARY ++ zend_declare_class_constant_long(ce, ZEND_STRL("SERIALIZER_IGBINARY"), REDIS_SERIALIZER_IGBINARY TSRMLS_CC); ++#endif + + /* scan options*/ + zend_declare_class_constant_long(ce, ZEND_STRL("OPT_SCAN"), REDIS_OPT_SCAN TSRMLS_CC); +@@ -541,9 +544,6 @@ static void add_class_constants(zend_class_entry *ce, int is_cluster TSRMLS_DC) + zend_declare_class_constant_long(ce, ZEND_STRL("FAILOVER_DISTRIBUTE"), REDIS_FAILOVER_DISTRIBUTE TSRMLS_CC); + zend_declare_class_constant_long(ce, ZEND_STRL("FAILOVER_DISTRIBUTE_SLAVES"), REDIS_FAILOVER_DISTRIBUTE_SLAVES TSRMLS_CC); + } +-#ifdef HAVE_REDIS_IGBINARY +- zend_declare_class_constant_long(ce, ZEND_STRL("SERIALIZER_IGBINARY"), REDIS_SERIALIZER_IGBINARY TSRMLS_CC); +-#endif + + zend_declare_class_constant_stringl(ce, "AFTER", 5, "after", 5 TSRMLS_CC); + zend_declare_class_constant_stringl(ce, "BEFORE", 6, "before", 6 TSRMLS_CC); diff --git a/redis-pr1063.patch b/redis-pr1063.patch new file mode 100644 index 0000000..0c4d68d --- /dev/null +++ b/redis-pr1063.patch @@ -0,0 +1,54 @@ +From 18c7ab007649f068075880984e59938b849b5ab5 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Fri, 16 Dec 2016 15:29:05 +0100 +Subject: [PATCH] fix #1062 restore 3.0.0 session behavior for PHP 7.1 + +--- + redis_session.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/redis_session.c b/redis_session.c +index 6faae20..2ac2872 100644 +--- a/redis_session.c ++++ b/redis_session.c +@@ -360,7 +360,7 @@ PS_READ_FUNC(redis) + resp = redis_session_key(rpm, key->val, key->len, &resp_len); + #endif + cmd_len = redis_cmd_format_static(&cmd, "GET", "s", resp, resp_len); +- ++ + efree(resp); + if(redis_sock_write(redis_sock, cmd, cmd_len TSRMLS_CC) < 0) { + efree(cmd); +@@ -368,15 +368,26 @@ PS_READ_FUNC(redis) + } + efree(cmd); + +- /* read response */ +- if ((resp = redis_sock_read(redis_sock, &resp_len TSRMLS_CC)) == NULL) { ++ /* Read response from Redis. If we get a NULL response from redis_sock_read ++ * this can indicate an error, OR a "NULL bulk" reply (empty session data) ++ * in which case we can reply with success. */ ++ if ((resp = redis_sock_read(redis_sock, &resp_len TSRMLS_CC)) == NULL && resp_len != -1) { + return FAILURE; + } + #if (PHP_MAJOR_VERSION < 7) +- *val = resp; +- *vallen = resp_len; ++ if (resp_len < 0) { ++ *val = STR_EMPTY_ALLOC(); ++ *vallen = 0; ++ } else { ++ *val = resp; ++ *vallen = resp_len; ++ } + #else +- *val = zend_string_init(resp, resp_len, 0); ++ if (resp_len < 0) { ++ *val = ZSTR_EMPTY_ALLOC(); ++ } else { ++ *val = zend_string_init(resp, resp_len, 0); ++ } + efree(resp); + #endif + diff --git a/redis-pr1064.patch b/redis-pr1064.patch new file mode 100644 index 0000000..3e43523 --- /dev/null +++ b/redis-pr1064.patch @@ -0,0 +1,31 @@ +From 4706aae6eacc62e45cd4280dc5bd80668d22641c Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Fri, 16 Dec 2016 15:31:11 +0100 +Subject: [PATCH] Fix #1060 don't return pointer to local volatile data + +--- + library.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/library.h b/library.h +index 8eb6708..6aef144 100644 +--- a/library.h ++++ b/library.h +@@ -88,7 +88,7 @@ PHP_REDIS_API void redis_client_list_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSo + #if ZEND_MODULE_API_NO >= 20100000 + #define REDIS_DOUBLE_TO_STRING(dbl_str, dbl) do { \ + char dbl_decsep = '.'; \ +- zend_string _zstr = {0}; \ ++ static zend_string _zstr = {0}; \ + _zstr.val = _php_math_number_format_ex(dbl, 16, &dbl_decsep, 1, NULL, 0); \ + _zstr.len = strlen(_zstr.val); \ + _zstr.gc = 0x10; \ +@@ -96,7 +96,7 @@ PHP_REDIS_API void redis_client_list_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSo + } while (0); + #else + #define REDIS_DOUBLE_TO_STRING(dbl_str, dbl) do { \ +- zend_string _zstr = {0}; \ ++ static zend_string _zstr = {0}; \ + _zstr.val = _php_math_number_format(dbl, 16, '.', '\x00'); \ + _zstr.len = strlen(_zstr.val); \ + _zstr.gc = 0x10; \ |