Commit Diff


commit - fc84243ebf25fdac511e6be44330ce42573fa81b
commit + e409734a22058795883c9c3bbbc21962857374cb
blob - 0e7a01d1a02163c46befaf88ea005ef7cb07219d
blob + febc47d215619ddb7ef87c69fac957e7bdac018f
--- tests/capi/luaL_loadbuffer_proto/luaL_loadbuffer_proto_test.cc
+++ tests/capi/luaL_loadbuffer_proto/luaL_loadbuffer_proto_test.cc
@@ -5,6 +5,10 @@
  * Copyright 2022, Tarantool AUTHORS.
  */
 
+#include <fstream>
+#include <string>
+#include <iostream>
+
 extern "C"
 {
 #include "lua.h"
@@ -304,6 +308,11 @@ DEFINE_PROTO_FUZZER(const lua_grammar::Block &message)
 	luaJIT_profile_dumpstack(L, "pfFlz", len, &depth);
 #endif /* LUAJIT */
 
+	std::size_t hash = std::hash<std::string>{}(code);
+	std::ofstream out("/tmp/corpus/" + std::to_string(hash) + ".lua");
+	out << code;
+	out.close();
+
 	if (luaL_loadbuffer(L, code.c_str(), code.size(), "fuzz") != LUA_OK) {
 		report_error(L, "luaL_loadbuffer()");
 		goto end;