1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:57:44 +00:00

AK: Add roundtrip fuzzer for Base64

This commit is contained in:
Martin Janiczek 2023-09-28 00:17:06 +02:00 committed by Tim Schumacher
parent 6c1626e83b
commit b56e022ce8
3 changed files with 23 additions and 0 deletions

View 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;
}