1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 20:07:35 +00:00

LibCompress: Upgrade compression fuzzer into a roundtrip fuzzer

This commit is contained in:
Martin Janiczek 2023-09-26 20:04:37 +02:00 committed by Tim Schumacher
parent 70ac6918d1
commit 0465ba242b
3 changed files with 10 additions and 4 deletions

View file

@ -0,0 +1,21 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCompress/Gzip.h>
#include <stdio.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
AK::set_debug_enabled(false);
auto input = ReadonlyBytes { data, size };
auto compressed = MUST(Compress::GzipCompressor::compress_all(input));
auto decompressed = MUST(Compress::GzipDecompressor::decompress_all(compressed));
VERIFY(decompressed == input);
return 0;
}