com php-src: Fix bug #72767: NEWS Zend/tests/bug72767.phpt Zend/zend_execute.c

From: Date: Fri, 05 Aug 2016 17:55:10 +0000
Subject: com php-src: Fix bug #72767: NEWS Zend/tests/bug72767.phpt Zend/zend_execute.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93624@lists.php.net to get a copy of this message
Commit: 807e81937b290ddb71152196aae3bbaca9a53c7e Author: Nikita Popov <nikic@php.net> Fri, 5 Aug 2016 19:51:51 +0200 Parents: 62f12a8b86fe40e5ce99d6280c4ee977ef46cc75 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=807e81937b290ddb71152196aae3bbaca9a53c7e Log: Fix bug #72767 The page size calculation did not account for the size of the stack header (or rather it did account for it, but in the wrong direction...) Bugs: https://bugs.php.net/72767 Changed paths: M NEWS A Zend/tests/bug72767.phpt M Zend/zend_execute.c Diff: diff --git a/NEWS b/NEWS index 7a82e02..623f31e 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2016 PHP 7.0.11 +- Core: + . Fixed bug #72767 (PHP Segfaults when trying to expand an infinite operator). + (Nikita) + - GD: . Fixed bug #72709 (imagesetstyle() causes OOB read for empty $styles). (cmb) diff --git a/Zend/tests/bug72767.phpt b/Zend/tests/bug72767.phpt new file mode 100644 index 0000000..20b559b --- /dev/null +++ b/Zend/tests/bug72767.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #72767: PHP Segfaults when trying to expand an infinite operator +--FILE-- +<?php + +function test() {} +$iterator = new LimitIterator( + new InfiniteIterator(new ArrayIterator([42])), + 0, 17000 +); +test(...$iterator); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index af90b44..a7df948 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -145,7 +145,8 @@ static const zend_internal_function zend_pass_function = { ((ZEND_VM_STACK_PAGE_SLOTS(gen) - ZEND_VM_STACK_HEADER_SLOTS) * sizeof(zval)) #define ZEND_VM_STACK_PAGE_ALIGNED_SIZE(gen, size) \ - (((size) + (ZEND_VM_STACK_FREE_PAGE_SIZE(gen) - 1)) & ~(ZEND_VM_STACK_PAGE_SIZE(gen) - 1)) + (((size) + ZEND_VM_STACK_HEADER_SLOTS * sizeof(zval) \ + + (ZEND_VM_STACK_PAGE_SIZE(gen) - 1)) & ~(ZEND_VM_STACK_PAGE_SIZE(gen) - 1)) static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend_vm_stack prev) { zend_vm_stack page = (zend_vm_stack)emalloc(size);

« previous php.cvs (#93624) next »