diff options
-rw-r--r-- | sapi/fuzzer/generate_unserializehash_corpus.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sapi/fuzzer/generate_unserializehash_corpus.php b/sapi/fuzzer/generate_unserializehash_corpus.php index 04c6ea1428..c7c5925428 100644 --- a/sapi/fuzzer/generate_unserializehash_corpus.php +++ b/sapi/fuzzer/generate_unserializehash_corpus.php @@ -6,5 +6,11 @@ $corpusDir = __DIR__ . '/corpus/unserializehash'; 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)); + try { + $serialized = serialize($ctx); + } catch (Exception $e) { + echo "Hash algorithm $algo could not be serialized.\n"; + continue; + } + file_put_contents($corpusDir . '/' . $algx, "x|" . $serialized); } |