[PATCH] D60836: [WebAssembly] Object: Improve error messages on invalid section
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 17:11:53 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358801: [WebAssembly] Object: Improve error messages on invalid section (authored by sbc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D60836?vs=195943&id=195944#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60836/new/
https://reviews.llvm.org/D60836
Files:
llvm/trunk/lib/Object/WasmObjectFile.cpp
llvm/trunk/test/Object/wasm-invalid-file.yaml
Index: llvm/trunk/test/Object/wasm-invalid-file.yaml
===================================================================
--- llvm/trunk/test/Object/wasm-invalid-file.yaml
+++ llvm/trunk/test/Object/wasm-invalid-file.yaml
@@ -14,3 +14,9 @@
# RUN: not llvm-objdump -h %t.wasm 2>&1 | FileCheck %s -check-prefix=CHECK-SECTION-SIZE
# CHECK-SECTION-SIZE: '{{.*}}.wasm': Section too large
+
+# RUN: yaml2obj %s > %t.wasm
+# # Append an section with invalid type (type 0x20, size 0x1, content 0x0)
+# RUN: echo -e -n "\x20\x01\x00" >> %t.wasm
+# RUN: not llvm-objdump -h %t.wasm 2>&1 | FileCheck %s -check-prefix=CHECK-SECTION-TYPE
+# CHECK-SECTION-TYPE: '{{.*}}.wasm': Invalid section type: 32
Index: llvm/trunk/lib/Object/WasmObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Object/WasmObjectFile.cpp
+++ llvm/trunk/lib/Object/WasmObjectFile.cpp
@@ -319,8 +319,8 @@
case wasm::WASM_SEC_DATACOUNT:
return parseDataCountSection(Ctx);
default:
- return make_error<GenericBinaryError>("Bad section type",
- object_error::parse_failed);
+ return make_error<GenericBinaryError>(
+ "Invalid section type: " + Twine(Sec.Type), object_error::parse_failed);
}
}
@@ -1607,7 +1607,7 @@
case wasm::WASM_SEC_EVENT:
return WASM_SEC_ORDER_EVENT;
default:
- llvm_unreachable("invalid section");
+ return WASM_SEC_ORDER_NONE;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60836.195944.patch
Type: text/x-patch
Size: 1457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190420/5d0248fe/attachment.bin>
More information about the llvm-commits
mailing list