Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/fuzz/format.cpp
2723 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
#include "Luau/Common.h"
3
4
#include <vector>
5
6
#include <stddef.h>
7
#include <stdint.h>
8
#include <string.h>
9
10
namespace Luau
11
{
12
void fuzzFormatString(const char* data, size_t size);
13
} // namespace Luau
14
15
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size)
16
{
17
for (Luau::FValue<bool>* flag = Luau::FValue<bool>::list; flag; flag = flag->next)
18
{
19
if (strncmp(flag->name, "Luau", 4) == 0)
20
flag->value = true;
21
}
22
23
// copy data to heap to make sure ASAN can catch out of bounds access
24
std::vector<char> str(Data, Data + Size);
25
26
Luau::fuzzFormatString(str.data(), str.size());
27
28
return 0;
29
}
30
31