mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
AK: Add roundtrip fuzzer for Base64
This commit is contained in:
committed by
Tim Schumacher
parent
6c1626e83b
commit
b56e022ce8
21
Meta/Lagom/Fuzzers/FuzzBase64Roundtrip.cpp
Normal file
21
Meta/Lagom/Fuzzers/FuzzBase64Roundtrip.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, the SerenityOS developers.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <AK/Base64.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 encoded = MUST(encode_base64(input));
|
||||||
|
auto decoded = MUST(decode_base64(encoded));
|
||||||
|
|
||||||
|
VERIFY(decoded == input);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
set(FUZZER_TARGETS
|
set(FUZZER_TARGETS
|
||||||
ASN1
|
ASN1
|
||||||
|
Base64Roundtrip
|
||||||
BLAKE2b
|
BLAKE2b
|
||||||
BMPLoader
|
BMPLoader
|
||||||
Brotli
|
Brotli
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
// TODO: Look into generating this from the authoritative list of fuzzing targets in fuzzer.cmake.
|
// TODO: Look into generating this from the authoritative list of fuzzing targets in fuzzer.cmake.
|
||||||
#define ENUMERATE_TARGETS(T) \
|
#define ENUMERATE_TARGETS(T) \
|
||||||
T(ASN1) \
|
T(ASN1) \
|
||||||
|
T(Base64Roundtrip) \
|
||||||
T(BLAKE2b) \
|
T(BLAKE2b) \
|
||||||
T(BMPLoader) \
|
T(BMPLoader) \
|
||||||
T(Brotli) \
|
T(Brotli) \
|
||||||
|
|||||||
Reference in New Issue
Block a user