php-src/sapi/fuzzer/generate_unserializehash_corpus.php
Eddie Kohler 75ada661b9 Add unserializehash fuzzer.
Unlike the straight unserialize fuzzer, this runs only on HashContexts,
and it does an update and finalize on the contexts it creates.

Co-authored-by: Nikita Popov <nikic@php.net>
2020-06-30 14:30:33 +02:00

11 lines
274 B
PHP

<?php
$corpusDir = __DIR__ . '/corpus/unserializehash';
@mkdir($corpusDir);
foreach (hash_algos() as $algo) {
$ctx = hash_init($algo);
$algx = preg_replace('/[^-_a-zA-Z0-9]/', '_', $algo);
file_put_contents($corpusDir . '/' . $algx, "x|" . serialize($ctx));
}