Title: [210414] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/JSTests/ChangeLog (210413 => 210414)


--- branches/safari-603-branch/JSTests/ChangeLog	2017-01-06 01:48:27 UTC (rev 210413)
+++ branches/safari-603-branch/JSTests/ChangeLog	2017-01-06 01:48:31 UTC (rev 210414)
@@ -1,5 +1,20 @@
 2017-01-05  Matthew Hanson  <[email protected]>
 
+        Merge r210203. rdar://problem/29815000
+
+    2016-12-28  Saam Barati  <[email protected]>
+
+            WebAssembly: Don't allow duplicate export names
+            https://bugs.webkit.org/show_bug.cgi?id=166490
+            <rdar://problem/29815000>
+
+            Reviewed by Keith Miller.
+
+            * wasm.yaml:
+            * wasm/function-tests/invalid-duplicate-export.js: Added.
+
+2017-01-05  Matthew Hanson  <[email protected]>
+
         Merge r210137. rdar://problem/29760386
 
     2016-12-23  Keith Miller  <[email protected]>

Added: branches/safari-603-branch/JSTests/wasm/function-tests/invalid-duplicate-export.js (0 => 210414)


--- branches/safari-603-branch/JSTests/wasm/function-tests/invalid-duplicate-export.js	                        (rev 0)
+++ branches/safari-603-branch/JSTests/wasm/function-tests/invalid-duplicate-export.js	2017-01-06 01:48:31 UTC (rev 210414)
@@ -0,0 +1,19 @@
+import Builder from '../Builder.js';
+import * as assert from '../assert.js';
+
+{
+    const builder = (new Builder())
+        .Type().End()
+        .Function().End()
+        .Export()
+            .Function("foo")
+            .Function("foo")
+        .End()
+        .Code()
+            .Function("foo", {params: [], ret: "void"})
+            .End()
+        .End();
+
+    const bin = builder.WebAssembly().get();
+    assert.throws(() => new WebAssembly.Module(bin), WebAssembly.CompileError, "WebAssembly.Module doesn't parse at byte 31 / 39: duplicate export: 'foo'");
+}

Modified: branches/safari-603-branch/JSTests/wasm.yaml (210413 => 210414)


--- branches/safari-603-branch/JSTests/wasm.yaml	2017-01-06 01:48:27 UTC (rev 210413)
+++ branches/safari-603-branch/JSTests/wasm.yaml	2017-01-06 01:48:31 UTC (rev 210414)
@@ -68,7 +68,7 @@
   cmd: runWebAssemblySpecTest :normal
 
 - path: wasm/spec-tests/exports.wast.js
-  cmd: runWebAssemblySpecTest :skip
+  cmd: runWebAssemblySpecTest :normal
 
 - path: wasm/spec-tests/f32.wast.js
   cmd: runWebAssemblySpecTest :normal

Modified: branches/safari-603-branch/Source/_javascript_Core/ChangeLog (210413 => 210414)


--- branches/safari-603-branch/Source/_javascript_Core/ChangeLog	2017-01-06 01:48:27 UTC (rev 210413)
+++ branches/safari-603-branch/Source/_javascript_Core/ChangeLog	2017-01-06 01:48:31 UTC (rev 210414)
@@ -1,5 +1,19 @@
 2017-01-05  Matthew Hanson  <[email protected]>
 
+        Merge r210203. rdar://problem/29815000
+
+    2016-12-28  Saam Barati  <[email protected]>
+
+            WebAssembly: Don't allow duplicate export names
+            https://bugs.webkit.org/show_bug.cgi?id=166490
+            <rdar://problem/29815000>
+
+            Reviewed by Keith Miller.
+
+            * wasm/WasmModuleParser.cpp:
+
+2017-01-05  Matthew Hanson  <[email protected]>
+
         Merge r210137. rdar://problem/29760386
 
     2016-12-23  Keith Miller  <[email protected]>

Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/WasmModuleParser.cpp (210413 => 210414)


--- branches/safari-603-branch/Source/_javascript_Core/wasm/WasmModuleParser.cpp	2017-01-06 01:48:27 UTC (rev 210413)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/WasmModuleParser.cpp	2017-01-06 01:48:31 UTC (rev 210414)
@@ -383,6 +383,7 @@
     WASM_PARSER_FAIL_IF(exportCount == std::numeric_limits<uint32_t>::max(), "Export section's count is too big ", exportCount);
     WASM_PARSER_FAIL_IF(!m_result.module->exports.tryReserveCapacity(exportCount), "can't allocate enough memory for ", exportCount, " exports");
 
+    HashSet<String> exportNames;
     for (uint32_t exportNumber = 0; exportNumber < exportCount; ++exportNumber) {
         Export exp;
         uint32_t fieldLen;
@@ -390,6 +391,8 @@
 
         WASM_PARSER_FAIL_IF(!parseVarUInt32(fieldLen), "can't get ", exportNumber, "th Export's field name length");
         WASM_PARSER_FAIL_IF(!consumeUTF8String(fieldString, fieldLen), "can't get ", exportNumber, "th Export's field name of length ", fieldLen);
+        WASM_PARSER_FAIL_IF(exportNames.contains(fieldString), "duplicate export: '", fieldString, "'");
+        exportNames.add(fieldString);
         exp.field = Identifier::fromString(m_vm, fieldString);
 
         WASM_PARSER_FAIL_IF(!parseExternalKind(exp.kind), "can't get ", exportNumber, "th Export's kind, named '", fieldString, "'");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to