ソースを参照

[MERGE #3171 @Cellule] Fix MOVSXD encoding for exception filter

Merge pull request #3171 from Cellule:users/micfer/wasm/movsxd

We were incorrectly reading the opcode for MOVSXD causing the AV in virtual memory to escape instead of throwing a WebAssembly runtime exception.
Since the AV occurs in the 8GB array, it is not a security concern.
Michael Ferris 8 年 前
コミット
09e2ba6ea1

+ 3 - 1
lib/Runtime/Library/JavascriptFunction.cpp

@@ -1918,6 +1918,8 @@ LABEL1:
             instrData.isLoad = false;
             break;
         }
+        //MOVSXD
+        case 0x63:
         //MOV - Load
         case 0x8A:
         case 0x8B:
@@ -1930,7 +1932,7 @@ LABEL1:
         {
             // more than one byte opcode and hence we will read pc multiple times
             pc++;
-            //MOVSX  , MOVSXD
+            //MOVSX
             if (*pc == 0xBE || *pc == 0xBF)
             {
                 instrData.isLoad = true;

+ 1 - 0
test/WasmSpec/baselines/memory_trap.baseline

@@ -0,0 +1 @@
+173/173 tests passed.

+ 0 - 1
test/WasmSpec/convert-test-suite/index.js

@@ -28,7 +28,6 @@ const argv = require("yargs")
       alias: "e",
       description: "Spec tests to exclude from the conversion (use for known failures)",
       default: [
-        "memory_trap",
         "traps",
       ]
     },

+ 16 - 0
test/WasmSpec/rlexe.xml

@@ -708,6 +708,22 @@
       <tags>exclude_dynapogo</tags>
     </default>
   </test>
+  <test>
+    <default>
+      <files>spec.js</files>
+      <baseline>baselines/memory_trap.baseline</baseline>
+      <compile-flags>-wasm -args testsuite/core/memory_trap.wast -endargs</compile-flags>
+      <tags>exclude_xplat</tags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>spec.js</files>
+      <baseline>baselines/memory_trap.baseline</baseline>
+      <compile-flags>-wasm -args testsuite/core/memory_trap.wast -endargs -nonative</compile-flags>
+      <tags>exclude_dynapogo,exclude_xplat</tags>
+    </default>
+  </test>
   <test>
     <default>
       <files>spec.js</files>