diff options
author | Keith Winstein <keithw@cs.stanford.edu> | 2022-12-23 16:25:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-23 16:25:37 -0800 |
commit | d9338f70a26cc9ee4e64da71ce3b50d4c44e0c03 (patch) | |
tree | fd063b0321fd3eee9e568bc8a5bfe0cad126c2e8 | |
parent | 9121857ced2e114269f29ec614414511103bdf45 (diff) | |
download | wabt-d9338f70a26cc9ee4e64da71ce3b50d4c44e0c03.tar.gz wabt-d9338f70a26cc9ee4e64da71ce3b50d4c44e0c03.tar.bz2 wabt-d9338f70a26cc9ee4e64da71ce3b50d4c44e0c03.zip |
wast-parser.cc: disallow exception tag unless exceptions enabled (#2110)
-rw-r--r-- | src/wast-parser.cc | 4 | ||||
-rw-r--r-- | test/dump/tag.txt | 2 | ||||
-rw-r--r-- | test/regress/regress-2110.txt | 11 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc index 863746c1..51cf52d8 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -1346,6 +1346,10 @@ Result WastParser::ParseElemModuleField(Module* module) { Result WastParser::ParseTagModuleField(Module* module) { WABT_TRACE(ParseTagModuleField); + if (!options_->features.exceptions_enabled()) { + Error(Consume().loc, "tag not allowed"); + return Result::Error; + } EXPECT(Lpar); EXPECT(Tag); std::string name; diff --git a/test/dump/tag.txt b/test/dump/tag.txt index 2e569f98..985b952b 100644 --- a/test/dump/tag.txt +++ b/test/dump/tag.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-objdump -;;; ARGS0: -v +;;; ARGS0: -v --enable-exceptions ;;; ARGS1: -x (module (tag) diff --git a/test/regress/regress-2110.txt b/test/regress/regress-2110.txt new file mode 100644 index 00000000..11b1187c --- /dev/null +++ b/test/regress/regress-2110.txt @@ -0,0 +1,11 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +(module + (tag $e0 (param i32)) +) + +(;; STDERR ;;; +out/test/regress/regress-2110.txt:4:3: error: tag not allowed + (tag $e0 (param i32)) + ^ +;;; STDERR ;;) |