Skip to content

Commit

Permalink
[Loader] Fix heap type syntax checking. (WasmEdge#3395)
Browse files Browse the repository at this point in the history
  • Loading branch information
q82419 authored May 9, 2024
1 parent abc43dc commit 8442569
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/loader/ast/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ namespace Loader {
Expect<ValType> Loader::loadHeapType(TypeCode TC, ASTNodeAttr From) {
if (auto Res = FMgr.readS33()) {
if (*Res < 0) {
// FuncRef or ExternRef case.
if (*Res < -64) {
// For checking the invalid s33 value which is larger than 1 byte.
return logLoadError(ErrCode::Value::MalformedRefType,
FMgr.getLastOffset(), From);
}
TypeCode HTCode =
static_cast<TypeCode>(static_cast<uint8_t>((*Res) & INT64_C(0x7F)));
switch (HTCode) {
Expand Down

0 comments on commit 8442569

Please sign in to comment.