php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74840 Opcache overwrites argument of GENERATOR_RETURN within finally
Submitted: 2017-07-01 09:41 UTC Modified: 2017-07-01 09:41 UTC
From: bwoebi@php.net Assigned: bwoebi (profile)
Status: Closed Package: opcache
PHP Version: master-Git-2017-07-01 (Git) OS: Irrelevant
Private report: No CVE-ID: None
 [2017-07-01 09:41 UTC] bwoebi@php.net
Description:
------------
Within generators, the temporary argument of GENERATOR_RETURN is ignored while reindexing temporaries in a finally block.
This leads to illegal reuse of a still live temporary and will leak/doubly use the temporary value returned by the generator.

Test script:
---------------
<?php

$g = (function($a) {
	try {
		return $a + 1;
	} finally {
		$b = $a + 2;
		var_dump($b);
	}
	yield; // Generator
})(1);
$g->next();
var_dump($g->getReturn());


Expected result:
----------------
int(3)
int(2)

Actual result:
--------------
int(3)
int(3)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-01 09:41 UTC] bwoebi@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: bwoebi
 [2017-07-01 09:52 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8
Log: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally)
 [2017-07-01 09:52 UTC] bwoebi@php.net
-Status: Assigned +Status: Closed
 [2017-07-01 09:52 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8
Log: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally)
 [2017-07-01 09:53 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8
Log: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC