]> granicus.if.org Git - php/commitdiff
Fixed bug #78391
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 9 Aug 2019 13:02:06 +0000 (15:02 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 9 Aug 2019 13:03:40 +0000 (15:03 +0200)
NEWS
ext/openssl/openssl.c
ext/openssl/tests/bug78391.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 21c109430fcee11a76b45f8fd5ccc11bd376edab..ff22389e0e340a6c78eafdc87cc3867b2315c047 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP                                                                        NEWS
   . Fixed bug #78383 (Casting a DateTime to array no longer returns its
     properties). (Nikita)
 
+- OpenSSL:
+  . Fixed bug #78391 (Assertion failure in openssl_random_pseudo_bytes).
+    (Nikita)
+
 08 Aug 2019, PHP 7.4.0beta2
 
 - Core:
index b8acb79f6ca4c907bb3c2318783fef2c252557b1..f566d4e6edbd2b34ff4d0a4f17d78145ba387595 100644 (file)
@@ -6974,7 +6974,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
        zend_long buffer_length;
        zval *zstrong_result_returned = NULL;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|z/", &buffer_length, &zstrong_result_returned) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|z", &buffer_length, &zstrong_result_returned) == FAILURE) {
                return;
        }
 
diff --git a/ext/openssl/tests/bug78391.phpt b/ext/openssl/tests/bug78391.phpt
new file mode 100644 (file)
index 0000000..936ef26
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #78391: Assertion failure in openssl_random_pseudo_bytes
+--FILE--
+<?php
+
+$isStrongCrypto = false;
+var_dump(strlen(openssl_random_pseudo_bytes(16, $isStrongCrypto)));
+var_dump($isStrongCrypto);
+
+?>
+--EXPECT--
+int(16)
+bool(true)