diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-10-27 10:08:05 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-10-27 10:08:05 +0100 |
commit | 5e13413472537ef4747ec781232ddd6c22e185df (patch) | |
tree | d21d2741e2d55fb8373e7e023a03e022ac24f4a3 /libsodium-pr62.patch | |
parent | 8f93032e7bc1df11c16056a604bb08fc4eddc82a (diff) |
php-pecl-libsodium: 1.0.1 + upstream patches
Diffstat (limited to 'libsodium-pr62.patch')
-rw-r--r-- | libsodium-pr62.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libsodium-pr62.patch b/libsodium-pr62.patch new file mode 100644 index 0000000..0a08cd5 --- /dev/null +++ b/libsodium-pr62.patch @@ -0,0 +1,38 @@ +From 3d2f71927f26c65ce7a631793ece893a86bc818a Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Tue, 27 Oct 2015 08:02:26 +0100 +Subject: [PATCH] don't zero interned string + +--- + libsodium.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/libsodium.c b/libsodium.c +index bc03b49..8bd1036 100644 +--- a/libsodium.c ++++ b/libsodium.c +@@ -396,15 +396,21 @@ PHP_FUNCTION(sodium_memzero) + return; + } + ZVAL_DEREF(buf_zv); ++ if (Z_TYPE_P(buf_zv) != IS_STRING) { ++ zend_error(E_ERROR, "memzero: a PHP string is required"); ++ } + #if PHP_MAJOR_VERSION >= 7 +- if (Z_REFCOUNTED_P(buf_zv) == 0 || Z_REFCOUNT(*buf_zv) > 1) { ++ if (IS_INTERNED(Z_STR(*buf_zv)) || Z_REFCOUNTED_P(buf_zv) == 0 || Z_REFCOUNT(*buf_zv) > 1) { + convert_to_null(buf_zv); + return; + } + #endif +- if (Z_TYPE_P(buf_zv) != IS_STRING) { +- zend_error(E_ERROR, "memzero: a PHP string is required"); ++#if PHP_MAJOR_VERSION < 7 && defined(IS_INTERNED) ++ if (IS_INTERNED(Z_STRVAL(*buf_zv))) { ++ convert_to_null(buf_zv); ++ return; + } ++#endif + buf = Z_STRVAL(*buf_zv); + buf_len = Z_STRLEN(*buf_zv); + if (buf_len > 0) { |