aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WasmObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index a6a4748..ed23c53 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -1124,6 +1124,9 @@ Error WasmObjectFile::parseImportSection(ReadContext &Ctx) {
}
case wasm::WASM_EXTERNAL_TAG:
NumImportedTags++;
+ if (readUint8(Ctx) != 0) // Reserved 'attribute' field
+ return make_error<GenericBinaryError>("invalid attribute",
+ object_error::parse_failed);
Im.SigIndex = readVaruint32(Ctx);
if (Im.SigIndex >= NumTypes)
return make_error<GenericBinaryError>("invalid tag type",
@@ -1203,8 +1206,7 @@ Error WasmObjectFile::parseTagSection(ReadContext &Ctx) {
Tags.reserve(Count);
uint32_t NumTypes = Signatures.size();
while (Count--) {
- char Attr = readUint8(Ctx); // Reserved 'attribute' field
- if (Attr != 0)
+ if (readUint8(Ctx) != 0) // Reserved 'attribute' field
return make_error<GenericBinaryError>("invalid attribute",
object_error::parse_failed);
uint32_t Type = readVaruint32(Ctx);