mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 19:32:44 +00:00 
			
		
		
		
	 1682f0b760
			
		
	
	
		1682f0b760
		
	
	
	
	
		
			
			SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			782 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			782 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <AK/StringView.h>
 | |
| #include <LibJS/Interpreter.h>
 | |
| #include <LibJS/Lexer.h>
 | |
| #include <LibJS/Parser.h>
 | |
| #include <LibJS/Runtime/GlobalObject.h>
 | |
| #include <stddef.h>
 | |
| #include <stdint.h>
 | |
| 
 | |
| extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
 | |
| {
 | |
|     auto js = StringView(static_cast<const unsigned char*>(data), size);
 | |
|     auto lexer = JS::Lexer(js);
 | |
|     auto parser = JS::Parser(lexer);
 | |
|     auto program = parser.parse_program();
 | |
|     if (!parser.has_errors()) {
 | |
|         auto vm = JS::VM::create();
 | |
|         auto interpreter = JS::Interpreter::create<JS::GlobalObject>(*vm);
 | |
|         interpreter->run(interpreter->global_object(), *program);
 | |
|     }
 | |
|     return 0;
 | |
| }
 |