forked from php/php-src
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix phpGH-12186: segfault copying/cloning a finalized HashContext
Closes php#12186
- Loading branch information
Showing
5 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,16 @@ | ||
--TEST-- | ||
Hash: bug #12186 - segfault in hash_copy() on a finalized context | ||
--FILE-- | ||
<?php | ||
|
||
$c = hash_init('sha1'); | ||
hash_final($c); | ||
hash_copy($c); | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught TypeError: hash_copy(): Argument #1 ($context) must be a valid, non-finalized HashContext in %s:5 | ||
Stack trace: | ||
#0 %s(5): hash_copy(Object(HashContext)) | ||
#1 {main} | ||
thrown in %s on line 5 |
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,15 @@ | ||
--TEST-- | ||
Hash: bug #12186 - segfault when cloning a finalized context | ||
--FILE-- | ||
<?php | ||
|
||
$c = hash_init('sha1'); | ||
hash_final($c); | ||
clone $c; | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught ValueError: Cannot clone a finalized HashContext in %s | ||
Stack trace: | ||
#0 {main} | ||
thrown in %s on line 5 |
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