aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/autogen/wasm
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-10-06 11:47:25 +0000
committerbloodstalker <thabogre@gmail.com>2018-10-06 11:47:25 +0000
commit381a95e59c2e8d03d609fdb8945ba09ecaee405c (patch)
tree0a0eb9bae908352312c736137c3b5b96dca9a968 /bruiser/autogen/wasm
parentmore bug fixes (diff)
downloadmutator-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
Diffstat (limited to '')
-rw-r--r--bruiser/autogen/wasm/ft/autowasm.c14
-rw-r--r--bruiser/autogen/wasm/test/aggregate.wasmbin0 -> 6668 bytes
-rw-r--r--bruiser/autogen/wasm/test/read.wasmbin0 -> 21963 bytes
-rw-r--r--bruiser/autogen/wasm/wasm.xml33
4 files changed, 12 insertions, 35 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
new file mode 100644
index 0000000..615e33b
--- /dev/null
+++ b/bruiser/autogen/wasm/test/aggregate.wasm
Binary files differ
diff --git a/bruiser/autogen/wasm/test/read.wasm b/bruiser/autogen/wasm/test/read.wasm
new file mode 100644
index 0000000..838851e
--- /dev/null
+++ b/bruiser/autogen/wasm/test/read.wasm
Binary files differ
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"/>