From 04ceba3232a19f8b4e9b0b05a6cc79361c519129 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Fri, 23 Dec 2022 00:08:56 -0500 Subject: [PATCH 1/2] wast-parser.cc: disallow exception tag unless exceptions enabled --- src/wast-parser.cc | 4 ++++ test/dump/tag.txt | 2 +- test/regress/regress-38.txt | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 test/regress/regress-38.txt diff --git a/src/wast-parser.cc b/src/wast-parser.cc index 863746c1d2..51cf52d841 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 2e569f98b9..985b952bf9 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-38.txt b/test/regress/regress-38.txt new file mode 100644 index 0000000000..9fd7bf4154 --- /dev/null +++ b/test/regress/regress-38.txt @@ -0,0 +1,11 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +(module + (tag $e0 (param i32)) +) + +(;; STDERR ;;; +out/test/regress/regress-38.txt:4:3: error: tag not allowed + (tag $e0 (param i32)) + ^ +;;; STDERR ;;) From 13fb8630ec9953355b333d990e05e6b82bdbbeac Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Fri, 23 Dec 2022 11:23:54 -0500 Subject: [PATCH 2/2] Renumber regression test --- test/regress/{regress-38.txt => regress-2110.txt} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename test/regress/{regress-38.txt => regress-2110.txt} (66%) diff --git a/test/regress/regress-38.txt b/test/regress/regress-2110.txt similarity index 66% rename from test/regress/regress-38.txt rename to test/regress/regress-2110.txt index 9fd7bf4154..11b1187c28 100644 --- a/test/regress/regress-38.txt +++ b/test/regress/regress-2110.txt @@ -5,7 +5,7 @@ ) (;; STDERR ;;; -out/test/regress/regress-38.txt:4:3: error: tag not allowed +out/test/regress/regress-2110.txt:4:3: error: tag not allowed (tag $e0 (param i32)) ^ ;;; STDERR ;;)