Commit Diff
- Commit:
e409734a22058795883c9c3bbbc21962857374cb- From:
- Sergey Bronnikov <sergeyb@tarantool.org>
- Date:
- Message:
- tests/capi: dump Lua samples mkdir /tmp/corpus RUNS=1 ctest -R luaL_loadbuffer_proto_test --verbose /home/sergeyb/sources/lua-c-api-tests/build/tests/capi/luaL_loadbuffer_proto/luaL_loadbuffer_proto_test -print_final_stats=1 -print_pcs=1 -reduce_inputs=1 -reload=1 -runs=1 -workers=22 -timeout=5 -jobs=5 /home/sergeyb/sources/lua-c-api-tests/corpus/corpus/luaL_loadbuffer_proto_test LUA_FUZZER_VERBOSE=1 LPM_DUMP_NATIVE_INPUT=1 /home/sergeyb/sources/lua-c-api-tests/build/tests/capi/luaL_loadbuffer_proto/luaL_loadbuffer_proto_test -print_final_stats=1 -print_pcs=1 -reduce_inputs=1 -reload=1 -runs=1 -workers=22 -timeout=5 /home/sergeyb/sources/lua-c-api-tests/corpus/corpus/luaL_loadbuffer_proto_test 2>&1 | tee log.txt ``` mkdir /tmp/lua-corpus/ go install github.com/yuin/gopher-lua/cmd/glua stat $GOPATH/bin/glua for f in /tmp/lua-corpus/*; do echo $f; glua $f; done ```
- Actions:
- Patch | Tree
--- 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;
