mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-12 21:10:37 +00:00
d50b079325
- Rework transaction log used for type checking which should result in more robust type checking internals with fewer bugs - Reduce the amount of memory consumed by type checker on large module graphs - Type checker now errors on attempts to change the type of imported module fields - The return type of newproxy is now any (fixes #296) - Implement new number printing algorithm (Schubfach) which makes tostring() produce precise (round-trippable) and short decimal output up to 10x faster - Fix lua_Debug::linedefined to point to the line with the function definition instead of the first statement (fixes #265) - Fix minor bugs in Tab completion in Repl - Repl now saves/restores command history in ~/.luau_history
35 lines
764 B
C++
35 lines
764 B
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "Luau/Common.h"
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
LUAU_FASTFLAG(LuauSchubfach);
|
|
|
|
#define LUAI_MAXNUM2STR 48
|
|
|
|
char* luai_num2str(char* buf, double n);
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size)
|
|
{
|
|
if (Size < 8)
|
|
return 0;
|
|
|
|
FFlag::LuauSchubfach.value = true;
|
|
|
|
double num;
|
|
memcpy(&num, Data, 8);
|
|
|
|
char buf[LUAI_MAXNUM2STR];
|
|
char* end = luai_num2str(buf, num);
|
|
LUAU_ASSERT(end < buf + sizeof(buf));
|
|
|
|
*end = 0;
|
|
|
|
double rec = strtod(buf, nullptr);
|
|
|
|
LUAU_ASSERT(rec == num || (rec != rec && num != num));
|
|
return 0;
|
|
}
|