forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix phpGH-17442: Engine UAF with reference assign and dtor
- Loading branch information
Showing
2 changed files
with
70 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
GH-17442 (Engine UAF with reference assign and dtor) | ||
--CREDITS-- | ||
YuanchengJiang | ||
--FILE-- | ||
<?php | ||
$map = new WeakMap; | ||
$obj = new stdClass; | ||
$map[$obj] = new class { | ||
function __destruct() { | ||
throw new Exception("Test"); | ||
} | ||
}; | ||
headers_sent($obj,$generator); | ||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught Exception: Test in %s:%d | ||
Stack trace: | ||
#0 [internal function]: class@anonymous->__destruct() | ||
#1 %s(%d): headers_sent('', 0) | ||
#2 {main} | ||
thrown in %s on line %d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters