1
0
mirror of https://github.com/php/php-src.git synced 2026-04-16 20:41:18 +02:00

Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1

* 'PHP-7.1' of git.php.net:/php-src:
  follow up fix on bug #74022
  Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators)
This commit is contained in:
Xinchen Hui
2017-05-19 23:56:31 +08:00
4 changed files with 58 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
--TEST--
Bug #74606 (Segfault within try/catch/finally nesting in Generators)
--FILE--
<?php
function gen() {
$array = ["foo"];
$array[] = "bar";
foreach ($array as $item) {
try {
try {
yield;
} finally {
echo "fin $item\n";
}
} catch (\Exception $e) {
echo "catch\n";
continue;
}
}
}
gen()->throw(new Exception);
?>
--EXPECT--
fin foo
catch
fin bar

View File

@@ -108,7 +108,7 @@ static void zend_generator_cleanup_unfinished_execution(
if (UNEXPECTED(generator->frozen_call_stack)) {
zend_generator_restore_call_stack(generator);
}
zend_cleanup_unfinished_execution(execute_data, op_num, 0);
zend_cleanup_unfinished_execution(execute_data, op_num, catch_op_num);
}
}
/* }}} */

View File

@@ -2941,6 +2941,7 @@ PHP_FUNCTION(openssl_pkcs12_read)
if (d2i_PKCS12_bio(bio_in, &p12) && PKCS12_parse(p12, pass, &pkey, &cert, &ca)) {
BIO * bio_out;
int cert_num;
zval_dtor(zout);
array_init(zout);
@@ -2971,10 +2972,11 @@ PHP_FUNCTION(openssl_pkcs12_read)
BIO_free(bio_out);
}
if (ca && sk_X509_num(ca)) {
cert_num = sk_X509_num(ca);
if (ca && cert_num) {
array_init(&zextracerts);
for (i = 0; i < sk_X509_num(ca); i++) {
for (i = 0; i < cert_num; i++) {
zval zextracert;
X509* aCA = sk_X509_pop(ca);
if (!aCA) break;

File diff suppressed because one or more lines are too long