summaryrefslogtreecommitdiff
path: root/ext/openssl/tests/bug38261.phpt
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2006-07-30 16:26:20 +0000
committerPierre Joye <pajoye@php.net>2006-07-30 16:26:20 +0000
commit5def392ce1207eee2c12f51479099829d24ba078 (patch)
tree2aa09b6f58c7f592b2aa7665554337280c34bcb3 /ext/openssl/tests/bug38261.phpt
parent71df07ac9ac5c29806d00340fa44c408222049ca (diff)
downloadphp-git-5def392ce1207eee2c12f51479099829d24ba078.tar.gz
- 38261: openssl_x509_parse leaks with invalid certs
Diffstat (limited to 'ext/openssl/tests/bug38261.phpt')
-rw-r--r--ext/openssl/tests/bug38261.phpt34
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt
new file mode 100644
index 0000000000..e7d806083e
--- /dev/null
+++ b/ext/openssl/tests/bug38261.phpt
@@ -0,0 +1,34 @@
+--TEST--
+openssl key from zval leaks
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+?>
+--FILE--
+<?php
+$cert = false;
+class test {
+ function __toString() {
+ return "test object";
+ }
+}
+$t = new test;
+
+var_dump(openssl_x509_parse("foo"));
+var_dump(openssl_x509_parse($t));
+var_dump(openssl_x509_parse(array()));
+var_dump(openssl_x509_parse());
+var_dump(openssl_x509_parse($cert));
+var_dump(openssl_x509_parse(new stdClass));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+
+Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %s/bug38261.php on line %d
+NULL
+bool(false)
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s/bug38261.php on line %d