|
|
@@ -1787,7 +1787,7 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
|
|
|
read_uint32(buf, buf_end, j);
|
|
|
#if WASM_ENABLE_AOT_VALIDATOR != 0
|
|
|
/* an equivalence type should be before the type it refers to */
|
|
|
- if (j > i) {
|
|
|
+ if (j >= i) {
|
|
|
set_error_buf(error_buf, error_buf_size, "invalid type index");
|
|
|
goto fail;
|
|
|
}
|
|
|
@@ -1964,6 +1964,13 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
|
|
|
|
|
|
read_uint8(buf, buf_end, struct_type->fields[j].field_flags);
|
|
|
read_uint8(buf, buf_end, field_type);
|
|
|
+#if WASM_ENABLE_AOT_VALIDATOR != 0
|
|
|
+ if (!is_valid_field_type(field_type)) {
|
|
|
+ set_error_buf(error_buf, error_buf_size,
|
|
|
+ "invalid field type");
|
|
|
+ goto fail;
|
|
|
+ }
|
|
|
+#endif
|
|
|
struct_type->fields[j].field_type = field_type;
|
|
|
struct_type->fields[j].field_size = field_size =
|
|
|
(uint8)wasm_reftype_size(field_type);
|