mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
Meta: Add Brotli fuzzer
This commit is contained in:
parent
7278ad761e
commit
1621724123
2 changed files with 25 additions and 0 deletions
|
@ -19,6 +19,7 @@ function(add_simple_fuzzer name)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_simple_fuzzer(FuzzBMPLoader LagomGfx)
|
add_simple_fuzzer(FuzzBMPLoader LagomGfx)
|
||||||
|
add_simple_fuzzer(FuzzBrotli LagomCompress)
|
||||||
add_simple_fuzzer(FuzzCyrillicDecoder LagomTextCodec)
|
add_simple_fuzzer(FuzzCyrillicDecoder LagomTextCodec)
|
||||||
add_simple_fuzzer(FuzzDeflateCompression LagomCompress)
|
add_simple_fuzzer(FuzzDeflateCompression LagomCompress)
|
||||||
add_simple_fuzzer(FuzzDeflateDecompression LagomCompress)
|
add_simple_fuzzer(FuzzDeflateDecompression LagomCompress)
|
||||||
|
|
24
Meta/Lagom/Fuzzers/FuzzBrotli.cpp
Normal file
24
Meta/Lagom/Fuzzers/FuzzBrotli.cpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LibCompress/Brotli.h>
|
||||||
|
#include <LibCore/MemoryStream.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
||||||
|
{
|
||||||
|
auto bufstream_result = Core::Stream::MemoryStream::construct({ const_cast<uint8_t*>(data), size });
|
||||||
|
if (bufstream_result.is_error()) {
|
||||||
|
dbgln("MemoryStream::construct() failed.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto bufstream = bufstream_result.release_value();
|
||||||
|
|
||||||
|
auto brotli_stream = Compress::BrotliDecompressionStream { *bufstream };
|
||||||
|
|
||||||
|
auto uncompressed = brotli_stream.read_all();
|
||||||
|
return uncompressed.is_error();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue