summaryrefslogtreecommitdiffstats
path: root/llvm/test/ObjectYAML
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-08-31 21:43:45 +0000
committerSam Clegg <sbc@chromium.org>2017-08-31 21:43:45 +0000
commita3b9fe6acdf60b91b460358858daf57bdb88bdbd (patch)
tree35418c04a71ff8f058c3aa479cca1966b9d036b9 /llvm/test/ObjectYAML
parent67419e39475f20e6b3164206f3233a0b1db896bf (diff)
downloadbcm5719-llvm-a3b9fe6acdf60b91b460358858daf57bdb88bdbd.tar.gz
bcm5719-llvm-a3b9fe6acdf60b91b460358858daf57bdb88bdbd.zip
[WebAssembly] Validate exports when parsing object files
Subscribers: jfb, dschuff, jgravelle-google, aheejin Differential Revision: https://reviews.llvm.org/D37358 llvm-svn: 312286
Diffstat (limited to 'llvm/test/ObjectYAML')
-rw-r--r--llvm/test/ObjectYAML/wasm/export_section.yaml14
-rw-r--r--llvm/test/ObjectYAML/wasm/invalid_export.yaml13
2 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/ObjectYAML/wasm/export_section.yaml b/llvm/test/ObjectYAML/wasm/export_section.yaml
index 89ebee32824..8c5f57c2992 100644
--- a/llvm/test/ObjectYAML/wasm/export_section.yaml
+++ b/llvm/test/ObjectYAML/wasm/export_section.yaml
@@ -3,6 +3,20 @@
FileHeader:
Version: 0x00000001
Sections:
+ - Type: FUNCTION
+ FunctionTypes: [ 0, 0 ]
+ - Type: GLOBAL
+ Globals:
+ - Type: I32
+ Mutable: false
+ InitExpr:
+ Opcode: I64_CONST
+ Value: 32
+ - Type: I32
+ Mutable: false
+ InitExpr:
+ Opcode: I64_CONST
+ Value: 64
- Type: EXPORT
Exports:
- Name: function_export
diff --git a/llvm/test/ObjectYAML/wasm/invalid_export.yaml b/llvm/test/ObjectYAML/wasm/invalid_export.yaml
new file mode 100644
index 00000000000..a61f8c4cfde
--- /dev/null
+++ b/llvm/test/ObjectYAML/wasm/invalid_export.yaml
@@ -0,0 +1,13 @@
+# RUN: yaml2obj < %s | not obj2yaml 2>&1 | FileCheck %s
+
+--- !WASM
+FileHeader:
+ Version: 0x00000001
+Sections:
+ - Type: EXPORT
+ Exports:
+ - Name: invalid_function_index
+ Kind: FUNCTION
+ Index: 0x00000001
+
+# CHECK: Error reading file: <stdin>: Invalid function export
OpenPOWER on IntegriCloud