diff options
author | bloodstalker <thabogre@gmail.com> | 2018-10-06 11:47:25 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-10-06 11:47:25 +0000 |
commit | 381a95e59c2e8d03d609fdb8945ba09ecaee405c (patch) | |
tree | 0a0eb9bae908352312c736137c3b5b96dca9a968 | |
parent | more bug fixes (diff) | |
download | mutator-381a95e59c2e8d03d609fdb8945ba09ecaee405c.tar.gz mutator-381a95e59c2e8d03d609fdb8945ba09ecaee405c.zip |
fixed more bugs on ft and ltg side. i had some fundamental misunderstandings on how clang encodes wasm objects. todo: test custom section getters and setters, garbage collection, repacking
-rw-r--r-- | bruiser/autogen/wasm/ft/autowasm.c | 14 | ||||
-rw-r--r-- | bruiser/autogen/wasm/test/aggregate.wasm | bin | 0 -> 6668 bytes | |||
-rw-r--r-- | bruiser/autogen/wasm/test/read.wasm | bin | 0 -> 21963 bytes | |||
-rw-r--r-- | bruiser/autogen/wasm/wasm.xml | 33 | ||||
-rw-r--r-- | bruiser/bruiser.cpp | 15 | ||||
m--------- | bruiser/faultreiber | 0 | ||||
-rw-r--r-- | bruiser/lua-scripts/wasmtest.lua | 226 |
7 files changed, 22 insertions, 266 deletions
diff --git a/bruiser/autogen/wasm/ft/autowasm.c b/bruiser/autogen/wasm/ft/autowasm.c index a766d2a..043f220 100644 --- a/bruiser/autogen/wasm/ft/autowasm.c +++ b/bruiser/autogen/wasm/ft/autowasm.c @@ -30,7 +30,7 @@ int main(int argc, char **argv) { wasm_lib_ret_t *lib_ret = read_aggr_wasm(wasm); printf("finished reading\n"); -#if 1 +#if 0 printf("magic_number:%x\n", lib_ret->obj->magic_number_container->magic_number); printf("version:%x\n", lib_ret->obj->version_container->version); @@ -229,12 +229,12 @@ int main(int argc, char **argv) { } #endif - printf("sizeof magic:%d\n", sizeof(magic_number)); - printf("sizeof version:%d\n", sizeof(version)); - printf("current void count:%d\n", lib_ret->current_void_count); - printf("void_train first:0x%x\n", lib_ret->void_train[0]); - printf("void_train first:0x%x\n", lib_ret->void_train[1]); - printf("void_train self address:0x%x\n", lib_ret->void_train); + //printf("sizeof magic:%d\n", sizeof(magic_number)); + //printf("sizeof version:%d\n", sizeof(version)); + //printf("current void count:%d\n", lib_ret->current_void_count); + //printf("void_train first:0x%x\n", lib_ret->void_train[0]); + //printf("void_train first:0x%x\n", lib_ret->void_train[1]); + //printf("void_train self address:0x%x\n", lib_ret->void_train); // free(lib_ret->void_train[0]); // release_all(lib_ret->void_train, lib_ret->current_void_count); // free(lib_ret->void_train[2]); diff --git a/bruiser/autogen/wasm/test/aggregate.wasm b/bruiser/autogen/wasm/test/aggregate.wasm Binary files differnew file mode 100644 index 0000000..615e33b --- /dev/null +++ b/bruiser/autogen/wasm/test/aggregate.wasm diff --git a/bruiser/autogen/wasm/test/read.wasm b/bruiser/autogen/wasm/test/read.wasm Binary files differnew file mode 100644 index 0000000..838851e --- /dev/null +++ b/bruiser/autogen/wasm/test/read.wasm diff --git a/bruiser/autogen/wasm/wasm.xml b/bruiser/autogen/wasm/wasm.xml index db68ed7..e1b9b32 100644 --- a/bruiser/autogen/wasm/wasm.xml +++ b/bruiser/autogen/wasm/wasm.xml @@ -2,91 +2,68 @@ <FT> <Read> <Magic_Number name="magic_number" type="uint32" count="1" luatype="integer"></Magic_Number> - <Version name="version" type="uint32" count="1" luatype="integer"></Version> + <Version name="w32_version" type="uint32" count="1" luatype="integer"></Version> <Type_Section name="W_Type_Section" count="1" type="" isaggregate="true" unordered="true" unorderedbegin="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">1</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Type_Section_Entry count="self::Count" type="self::Type_Section_Entry" name="entries" luatype="lightuserdata"/> </Type_Section> <Import_Section name="W_Import_Section" count="1" type="" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">2</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Entries name="entries" type="self::Import_Section_Entry" count="self::Count" luatype="lightuserdata"/> </Import_Section> <Function_Section name="W_Function_Section" count="1" type="" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="" luatype="integer">3</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Types name="types" encoding="leb128u" type="uint32" count="self::Count" luatype="lightuserdata"/> </Function_Section> <Table_Section name="W_Table_Section" count="1" type="" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">4</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Entries name="entries" type="self::Table_Type" count="self::Count" luatype="lightuserdata"/> </Table_Section> <Memory_Section name="W_Memory_Section" count="1" type="" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">5</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> - <!--<Count name="count" encoding="leb128u" type="uint32" count="1"/>--> <Entries name="entries" type="self::Memory_Type" count="1" luatype="lightuserdata"/> </Memory_Section> <Global_Section name="W_Global_Section" count="1" type="" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">6</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Globals name="globals" type="self::Global_Entry" count="self::Count" luatype="lightuserdata"/> </Global_Section> <Export_Section name="W_Export_Section" count="1" type="" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">7</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Entries name="entries" type="self::Export_Entry" count="self::Count" luatype="lightuserdata"/> </Export_Section> <Start_Section name="W_Start_Section" count="1" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">8</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Index name="index" encoding="leb128u" type="uint32" count="1" luatype="integer"/> </Start_Section> <Element_Section name="W_Element_Section" count="1" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">9</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Entries name="entries" type="self::Element_Segment" count="self::Count" luatype="lightuserdata"/> </Element_Section> <Code_Section name="W_Code_Section" count="1" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">10</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Bodies name="bodies" type="self::Function_Body" count="self::Count" luatype="lightuserdata"/> </Code_Section> <Data_Section name="W_Data_Section" count="1" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">11</ID> <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/> - <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> - <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Entries name="entries" type="self::Data_Segment" count="self::Count" luatype="lightuserdata"/> </Data_Section> @@ -154,15 +131,15 @@ <Num_Length name="num_length" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Elems name="elems" encoding="leb128u" type="uint32" count="self::Num_Length" luatype="lightuserdata"/> </Element_Segment> - <Local_Entry name="W_Local_Entry" isaggregate="true" luatype="lightuserdata"> + <Local_Entry name="W_Local_Entry" isaggregate="true" luatype="lightuserdata" countversion="true"> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> <Type name="type" encoding="leb128u" type="uint16" count="1" luatype="integer"/> </Local_Entry> <Function_Body name="W_Function_Body" isaggregate="true" luatype="lightuserdata"> <Body_size name="body_size" encoding="leb128u" type="uint32" count="1" luatype="integer"/> - <Local_Count name="local_count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> - <Local_Entries name="locals" type="self::Local_Entry" count="self::Local_Count" luatype="lightuserdata"/> - <Code name="code" type="uint8" count="self::Body_size" luatype="lightuserdata"/> + <Local_Count name="local_count" encoding="leb128u" type="uint32" count="1" luatype="integer" sizeconst="true"/> + <Local_Entries name="locals" type="self::Local_Entry" count="self::Local_Count" luatype="lightuserdata" sizeconst="true"/> + <Code name="code" type="uint8" count="self::Body_size" luatype="lightuserdata" sizeconst="end"/> </Function_Body> <Data_Segment name="W_Data_Segment" isaggregate="true" luatype="lightuserdata"> <Index name="index" encoding="leb128u" type="uint32" count="1" luatype="integer"/> diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp index 048dc54..6e73a44 100644 --- a/bruiser/bruiser.cpp +++ b/bruiser/bruiser.cpp @@ -1422,10 +1422,9 @@ class LuaWrapper { else { if (Verbose) PRINT_WITH_COLOR_LB(GREEN, "good file"); } + PRINT_WITH_COLOR_LB(RED, "before"); wasm_lib_ret_t* lib_ret = read_aggr_wasm(wasm_file); - //std::cout << RED << std::hex << lib_ret->obj->magic_number_container->magic_number << "\n"; - //std::cout << lib_ret->obj->version_container->version << NORMAL << "\n"; - //std::cout << "die die die\n"; + PRINT_WITH_COLOR_LB(RED, "after"); close(wasm_file); #pragma clang diagnostic push @@ -1433,7 +1432,7 @@ class LuaWrapper { #pragma clang diagnostic ignored "-Wextra" if (Verbose) { printf("magic_number:%x\n", lib_ret->obj->magic_number_container->magic_number); - printf("version:%x\n", lib_ret->obj->version_container->version); + printf("version:%x\n", lib_ret->obj->w32_version_container->w32_version); printf("type section id:%d\n", lib_ret->obj->W_Type_Section_container->id); printf("type section payloadlength:%d\n", lib_ret->obj->W_Type_Section_container->payloadlength); @@ -1567,10 +1566,10 @@ class LuaWrapper { } //PRINT_WITH_COLOR_LB(BLUE, "magic"); - if (lib_ret->obj->version_container != NULL) { + if (lib_ret->obj->w32_version_container != NULL) { lua_pushstring(__ls, "version"); - version_push_args(__ls, lib_ret->obj->version_container); - new_version(__ls); + w32_version_push_args(__ls, lib_ret->obj->w32_version_container); + new_w32_version(__ls); lua_settable(__ls, -3); } //PRINT_WITH_COLOR_LB(BLUE, "version"); @@ -1662,6 +1661,8 @@ class LuaWrapper { lua_settable(__ls, -3); } //PRINT_WITH_COLOR_LB(BLUE, "data section"); + if (lib_ret->obj->W_Custom_Section_container != NULL) { + } return 1; } diff --git a/bruiser/faultreiber b/bruiser/faultreiber -Subproject bddc4103d3f56cd25017f6948ea6a5eaa146bef +Subproject da65d18f0ebf28cb8a829a946d51d7111f6b493 diff --git a/bruiser/lua-scripts/wasmtest.lua b/bruiser/lua-scripts/wasmtest.lua index f005448..df59773 100644 --- a/bruiser/lua-scripts/wasmtest.lua +++ b/bruiser/lua-scripts/wasmtest.lua @@ -8,8 +8,6 @@ function libwasm.dump_type_section(a) if a["type_section"] ~= nil then io.write(tostring("id:"..a["type_section"]:id()).."\n") io.write(tostring("payloadlength:"..a["type_section"]:payloadlength()).."\n") - io.write(tostring("namelength:"..a["type_section"]:namelength()).."\n") - io.write(tostring("name:"..a["type_section"]:name()).."\n") io.write(tostring("count:"..a["type_section"]:count()).."\n") io.write("entries"..tostring(a["type_section"]:entries()).."\n") for k, v in pairs(a["type_section"]:entries()) do @@ -29,8 +27,6 @@ function libwasm.dump_import_section(a) if a["import_section"] ~= nil then io.write("id:"..tostring(a["import_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["import_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["import_section"]:namelength()).."\n") - io.write("name:"..tostring(a["import_section"]:name()).."\n") io.write("count:"..tostring(a["import_section"]:count()).."\n") io.write("entries"..tostring(a["import_section"]:entries()).."\n") for k, v in pairs(a["import_section"]:entries()) do @@ -52,8 +48,6 @@ function libwasm.dump_function_section(a) if a["function_section"] ~= nil then io.write("id:"..tostring(a["function_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["function_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["function_section"]:namelength()).."\n") - io.write("name:"..tostring(a["function_section"]:name()).."\n") io.write("count:"..tostring(a["function_section"]:count()).."\n") io.write("types:"..tostring(a["function_section"]:types()).."\n") for k,v in pairs(a["function_section"]:types()) do @@ -69,8 +63,6 @@ function libwasm.dump_table_section(a) if a["table_section"] ~= nil then io.write("id:"..tostring(a["table_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["table_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["table_section"]:namelength()).."\n") - io.write("name:"..tostring(a["table_section"]:name()).."\n") io.write("count:"..tostring(a["table_section"]:count()).."\n") io.write("entries:"..tostring(a["table_section"]:entries()).."\n") for k, v in pairs(a["table_section"]:entries()) do @@ -91,8 +83,6 @@ function libwasm.dump_memory_section(a) if a["memory_section"] ~= nil then io.write("id:"..tostring(a["memory_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["memory_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["memory_section"]:namelength()).."\n") - io.write("name:"..tostring(a["memory_section"]:name()).."\n") --for wasm v.1.0. memory section count is 1 --io.write("count:"..tostring(a["memory_section"]:count()).."\n") io.write("entries:"..tostring(a["memory_section"]:entries()).."\n") @@ -109,8 +99,6 @@ function libwasm.dump_global_section(a) if (a["global_section"] ~= nil) then io.write("id:"..tostring(a["global_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["global_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["global_section"]:namelength()).."\n") - io.write("name:"..tostring(a["global_section"]:name()).."\n") io.write("count:"..tostring(a["global_section"]:count()).."\n") io.write("globals:"..tostring(a["global_section"]:globals()).."\n") for k, v in pairs(a["global_section"]:globals()) do @@ -128,8 +116,6 @@ function libwasm.dump_export_section(a) if (a["export_section"] ~= nil) then io.write("id:"..tostring(a["export_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["export_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["export_section"]:namelength()).."\n") - io.write("name:"..tostring(a["export_section"]:name()).."\n") io.write("count:"..tostring(a["export_section"]:count()).."\n") io.write("entries:"..tostring(a["export_section"]:entries()).."\n") for k, v in pairs(a["export_section"]:entries()) do @@ -148,8 +134,6 @@ function libwasm.dump_start_section(a) if (a["start_section"] ~= nil) then io.write("id:"..tostring(a["start_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["start_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["start_section"]:namelength()).."\n") - io.write("name:"..tostring(a["start_section"]:name()).."\n") io.write("index:"..tostring(a["start_section"]:index()).."\n") else print(colors("%{red}".."section doesnt exist.")) @@ -161,8 +145,6 @@ function libwasm.dump_element_section(a) if (a["element_section"] ~= nil) then io.write("id:"..tostring(a["element_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["element_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["element_section"]:namelength()).."\n") - io.write("name:"..tostring(a["element_section"]:name()).."\n") io.write("count:"..tostring(a["element_section"]:count()).."\n") io.write(colors("%{cyan}".."entries:"..tostring(a["element_section"]:entries()).."\n")) for k, v in pairs(a["element_section"]:entries()) do @@ -190,8 +172,6 @@ function libwasm.dump_code_section(a) if (a["code_section"] ~= nil) then io.write("id:"..tostring(a["code_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["code_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["code_section"]:namelength()).."\n") - io.write("name:"..tostring(a["code_section"]:name()).."\n") io.write("count:"..tostring(a["code_section"]:count()).."\n") io.write("bodies:"..tostring(a["code_section"]:bodies()).."\n") for k,v in pairs(a["code_section"]:bodies()) do @@ -219,8 +199,6 @@ function libwasm.dump_data_section(a) if (a["data_section"] ~= nil) then io.write("id:"..tostring(a["data_section"]:id()).."\n") io.write("payloadlength:"..tostring(a["data_section"]:payloadlength()).."\n") - io.write("namelength:"..tostring(a["data_section"]:namelength()).."\n") - io.write("name:"..tostring(a["data_section"]:name()).."\n") io.write("count:"..tostring(a["data_section"]:count()).."\n") io.write("entries:"..tostring(a["data_section"]:entries()).."\n") if type(a["data_section"]:entries()) == "table" then @@ -314,26 +292,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."type_section:payloadlength:pass\n")) end - pre = a["type_section"]:namelength() - a["type_section"]:set_namelength(10) - post = a["type_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."type_section:namelength:failure\n")) - success = false - else - io.write(colors("%{green}".."type_section:namelength:pass\n")) - end - - pre = a["type_section"]:name() - a["type_section"]:set_name("type_section") - post = a["type_section"]:name() - if pre == post then - io.write(colors("%{red}".."type_section:name:failure\n")) - success = false - else - io.write(colors("%{green}".."type_section:name:pass\n")) - end - pre = a["type_section"]:count() a["type_section"]:set_count(13) post = a["type_section"]:count() @@ -402,24 +360,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."import_section:payloadlength:pass\n")) end - pre = a["import_section"]:namelength() - a["import_section"]:set_namelength(17) - post = a["import_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."import_section:namelength:failure\n")) - else - io.write(colors("%{green}".."import_section:namelength:pass\n")) - end - - pre = a["import_section"]:name() - a["import_section"]:set_name("import_section") - post = a["import_section"]:name() - if pre == post then - io.write(colors("%{red}".."import_section:name:failure\n")) - else - io.write(colors("%{green}".."import_section:name:pass\n")) - end - pre = a["import_section"]:count() a["import_section"]:set_count(13) post = a["import_section"]:count() @@ -456,24 +396,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."function_section:payloadlength:pass\n")) end - pre = a["function_section"]:namelength() - a["function_section"]:set_namelength(17) - post = a["function_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."function_section:namelength:failure\n")) - else - io.write(colors("%{green}".."function_section:namelength:pass\n")) - end - - pre = a["function_section"]:name() - a["function_section"]:set_name("function_section") - post = a["function_section"]:name() - if pre == post then - io.write(colors("%{red}".."function_section:name:failure\n")) - else - io.write(colors("%{green}".."function_section:name:pass\n")) - end - pre = a["function_section"]:count() a["function_section"]:set_count(13) post = a["function_section"]:count() @@ -523,24 +445,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."table_section:payloadlength:pass\n")) end - pre = a["table_section"]:namelength() - a["table_section"]:set_namelength(17) - post = a["table_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."table_section:namelength:failure\n")) - else - io.write(colors("%{green}".."table_section:namelength:pass\n")) - end - - pre = a["table_section"]:name() - a["table_section"]:set_name("table_section") - post = a["table_section"]:name() - if pre == post then - io.write(colors("%{red}".."table_section:name:failure\n")) - else - io.write(colors("%{green}".."table_section:name:pass\n")) - end - pre = a["table_section"]:count() a["table_section"]:set_count(13) post = a["table_section"]:count() @@ -605,24 +509,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."memory_section:payloadlength:pass\n")) end - pre = a["memory_section"]:namelength() - a["memory_section"]:set_namelength(17) - post = a["memory_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."memory_section:namelength:failure\n")) - else - io.write(colors("%{green}".."memory_section:namelength:pass\n")) - end - - pre = a["memory_section"]:name() - a["memory_section"]:set_name("memory_section") - post = a["memory_section"]:name() - if pre == post then - io.write(colors("%{red}".."memory_section:name:failure\n")) - else - io.write(colors("%{green}".."memory_section:name:pass\n")) - end - --for wasm v1.0. memory section count is 1 so this part doesnt make any sense --[[ pre = a["memory_section"]:count() @@ -675,24 +561,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."global_section:payloadlength:pass\n")) end - pre = a["global_section"]:namelength() - a["global_section"]:set_namelength(17) - post = a["global_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."global_section:namelength:failure\n")) - else - io.write(colors("%{green}".."global_section:namelength:pass\n")) - end - - pre = a["global_section"]:name() - a["global_section"]:set_name("global_section") - post = a["global_section"]:name() - if pre == post then - io.write(colors("%{red}".."global_section:name:failure\n")) - else - io.write(colors("%{green}".."global_section:name:pass\n")) - end - pre = a["global_section"]:count() a["global_section"]:set_count(13) post = a["global_section"]:count() @@ -744,24 +612,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."export_section:payloadlength:pass\n")) end - pre = a["export_section"]:namelength() - a["export_section"]:set_namelength(17) - post = a["export_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."export_section:namelength:failure\n")) - else - io.write(colors("%{green}".."export_section:namelength:pass\n")) - end - - pre = a["export_section"]:name() - a["export_section"]:set_name("export_section") - post = a["export_section"]:name() - if pre == post then - io.write(colors("%{red}".."export_section:name:failure\n")) - else - io.write(colors("%{green}".."export_section:name:pass\n")) - end - pre = a["export_section"]:count() a["export_section"]:set_count(13) post = a["export_section"]:count() @@ -821,24 +671,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."start_section:payloadlength:pass\n")) end - pre = a["start_section"]:namelength() - a["start_section"]:set_namelength(17) - post = a["start_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."start_section:namelength:failure\n")) - else - io.write(colors("%{green}".."start_section:namelength:pass\n")) - end - - pre = a["start_section"]:name() - a["start_section"]:set_name("start_section") - post = a["start_section"]:name() - if pre == post then - io.write(colors("%{red}".."start_section:name:failure\n")) - else - io.write(colors("%{green}".."start_section:name:pass\n")) - end - pre = a["start_section"]:index() a["start_section"]:set_index(13) post = a["start_section"]:index() @@ -873,24 +705,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."element_section:payloadlength:pass\n")) end - pre = a["element_section"]:namelength() - a["element_section"]:set_namelength(17) - post = a["element_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."element_section:namelength:failure\n")) - else - io.write(colors("%{green}".."element_section:namelength:pass\n")) - end - - pre = a["element_section"]:name() - a["element_section"]:set_name("element_section") - post = a["element_section"]:name() - if pre == post then - io.write(colors("%{red}".."element_section:name:failure\n")) - else - io.write(colors("%{green}".."element_section:name:pass\n")) - end - pre = a["element_section"]:count() a["element_section"]:set_count(13) post = a["element_section"]:count() @@ -973,24 +787,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."code_section:payloadlength:pass\n")) end - pre = a["code_section"]:namelength() - a["code_section"]:set_namelength(17) - post = a["code_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."code_section:namelength:failure\n")) - else - io.write(colors("%{green}".."code_section:namelength:pass\n")) - end - - pre = a["code_section"]:name() - a["code_section"]:set_name("code_section") - post = a["code_section"]:name() - if pre == post then - io.write(colors("%{red}".."code_section:name:failure\n")) - else - io.write(colors("%{green}".."code_section:name:pass\n")) - end - pre = a["code_section"]:count() a["code_section"]:set_count(13) post = a["code_section"]:count() @@ -1062,24 +858,6 @@ function libwasm.demo_setters(wasm_path) io.write(colors("%{green}".."data_section:payloadlength:pass\n")) end - pre = a["data_section"]:namelength() - a["data_section"]:set_namelength(17) - post = a["data_section"]:namelength() - if pre == post then - io.write(colors("%{red}".."data_section:namelength:failure\n")) - else - io.write(colors("%{green}".."data_section:namelength:pass\n")) - end - - pre = a["data_section"]:name() - a["data_section"]:set_name("data_section") - post = a["data_section"]:name() - if pre == post then - io.write(colors("%{red}".."data_section:name:failure\n")) - else - io.write(colors("%{green}".."data_section:name:pass\n")) - end - pre = a["data_section"]:count() a["data_section"]:set_count(13) post = a["data_section"]:count() @@ -1131,8 +909,8 @@ function libwasm.demo_setters(wasm_path) end --libwasm.dev("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm") ---libwasm.demo_getters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm") -libwasm.demo_getters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/aggregate.wasm") +--libwasm.demo_getters("/home/bloodstalker/extra/faultreiber/test/read.wasm") +libwasm.demo_getters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/test/read.wasm") --libwasm.demo_setters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm") --libwasm.dump_all("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm") |