1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/hash/tests/bug81714.phpt
Christoph M. Becker c2eafc29f5 Fix #81714: segfault when serializing finalized HashContext
We must not allow to serialize already finalized `HashContext`s, since
the internal context is already freed.  Since there is not much point
in serializing finalized `HashContext`s, we just bail out in that case.

Closes GH-8265.
2022-04-05 13:25:22 +02:00

15 lines
291 B
PHP

--TEST--
Bug #81714 (segfault when serializing finalized HashContext)
--FILE--
<?php
$h = hash_init('md5');
hash_final($h);
try {
serialize($h);
} catch (Exception $ex) {
var_dump($ex->getMessage());
}
?>
--EXPECTF--
string(52) "HashContext for algorithm "md5" cannot be serialized"