summaryrefslogtreecommitdiffstats
path: root/libsodium-pr62.patch
diff options
context:
space:
mode:
Diffstat (limited to 'libsodium-pr62.patch')
-rw-r--r--libsodium-pr62.patch38
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) {