Fix read and validation of misc/simd/atomic sub opcodes (#3115)
The format of sub opcodes after misc, simd and atomic prefix is leb u32. The issue was found in #2921.
This commit is contained in:
@ -627,8 +627,10 @@ main(int argc, char *argv[])
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
if (get_package_type(wasm_file, wasm_file_size) != Wasm_Module_Bytecode) {
|
||||
printf("Invalid file type: expected wasm file but got other\n");
|
||||
if (wasm_file_size >= 4 /* length of MAGIC NUMBER */
|
||||
&& get_package_type(wasm_file, wasm_file_size)
|
||||
!= Wasm_Module_Bytecode) {
|
||||
printf("Invalid wasm file: magic header not detected\n");
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user