Annotation of embedaddon/php/ext/openssl/tests/bug38255.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: openssl key from zval leaks
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded("openssl")) die("skip");
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9: $pub_key_id = false;
! 10: $signature = '';
! 11: $ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
! 12:
! 13: class test {
! 14: function __toString() {
! 15: return "test object";
! 16: }
! 17: }
! 18: $t = new test;
! 19:
! 20:
! 21: var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
! 22: var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
! 23: var_dump(openssl_verify("foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
! 24: var_dump(openssl_verify("foo", new stdClass, array(), OPENSSL_ALGO_MD5));
! 25: var_dump(openssl_verify("foo", array(), array(), OPENSSL_ALGO_MD5));
! 26: var_dump(openssl_verify());
! 27: var_dump(openssl_verify(new stdClass, new stdClass, array(), 10000));
! 28:
! 29: echo "Done\n";
! 30:
! 31: ?>
! 32: --EXPECTF--
! 33: Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
! 34:
! 35: Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
! 36: bool(false)
! 37:
! 38: Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
! 39: bool(false)
! 40:
! 41: Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
! 42: NULL
! 43:
! 44: Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
! 45: NULL
! 46:
! 47: Warning: openssl_verify() expects parameter 2 to be string, array given in %s on line %d
! 48: NULL
! 49:
! 50: Warning: openssl_verify() expects at least 3 parameters, 0 given in %s on line %d
! 51: NULL
! 52:
! 53: Warning: openssl_verify() expects parameter 1 to be string, object given in %s on line %d
! 54: NULL
! 55: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>