Changeset 220894 in webkit


Ignore:
Timestamp:
Aug 17, 2017 6:04:00 PM (7 years ago)
Author:
jfbastien@apple.com
Message:

WebAssembly: const in unreachable code decoded incorrectly, erroneously rejects binary as invalid
https://bugs.webkit.org/show_bug.cgi?id=175693
<rdar://problem/33952443>

Reviewed by Saam Barati.

JSTests:

Add a regression directory for WebAssembly tests.

  • wasm.yaml:
  • wasm/regress/175693.js: Added.

(else.else):
(instance.new.WebAssembly.Instance.new.WebAssembly.Module):
(catch):

  • wasm/regress/175693.wasm: Added.

Source/JavaScriptCore:

64-bit constants in an unreachable context were being decoded as
32-bit constants. This is pretty benign because unreachable code
shouldn't occur often. The effect is that 64-bit constants which
can't be encoded as 32-bit constants would cause the binary to be
rejected.

At the same time, 32-bit integer constants should be decoded as signed.

  • wasm/WasmFunctionParser.h:

(JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression):

Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r220778 r220894  
     12017-08-17  JF Bastien  <jfbastien@apple.com>
     2
     3        WebAssembly: const in unreachable code decoded incorrectly, erroneously rejects binary as invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=175693
     5        <rdar://problem/33952443>
     6
     7        Reviewed by Saam Barati.
     8
     9        Add a regression directory for WebAssembly tests.
     10
     11        * wasm.yaml:
     12        * wasm/regress/175693.js: Added.
     13        (else.else):
     14        (instance.new.WebAssembly.Instance.new.WebAssembly.Module):
     15        (catch):
     16        * wasm/regress/175693.wasm: Added.
     17
    1182017-08-15  Robin Morisset  <rmorisset@apple.com>
    219
  • trunk/JSTests/wasm.yaml

    r218868 r220894  
    3636- path: wasm/lowExecutableMemory
    3737  cmd: runWebAssemblyLowExecutableMemory unless parseRunCommands
     38- path: wasm/regress/
     39  cmd: runWebAssembly unless parseRunCommands
    3840
    3941- path: wasm/spec-tests/address.wast.js
  • trunk/Source/JavaScriptCore/ChangeLog

    r220890 r220894  
     12017-08-17  JF Bastien  <jfbastien@apple.com>
     2
     3        WebAssembly: const in unreachable code decoded incorrectly, erroneously rejects binary as invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=175693
     5        <rdar://problem/33952443>
     6
     7        Reviewed by Saam Barati.
     8
     9        64-bit constants in an unreachable context were being decoded as
     10        32-bit constants. This is pretty benign because unreachable code
     11        shouldn't occur often. The effect is that 64-bit constants which
     12        can't be encoded as 32-bit constants would cause the binary to be
     13        rejected.
     14
     15        At the same time, 32-bit integer constants should be decoded as signed.
     16
     17        * wasm/WasmFunctionParser.h:
     18        (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression):
     19
    1202017-08-17  Robin Morisset  <rmorisset@apple.com>
    221
  • trunk/Source/JavaScriptCore/wasm/WasmFunctionParser.h

    r218216 r220894  
    605605
    606606    // one immediate cases
    607     case I32Const:
    608     case I64Const:
    609607    case SetLocal:
    610608    case GetLocal:
     
    620618    }
    621619
     620    case I32Const: {
     621        int32_t unused;
     622        WASM_PARSER_FAIL_IF(!parseVarInt32(unused), "can't get immediate for ", m_currentOpcode, " in unreachable context");
     623        return { };
     624    }
     625
     626    case I64Const: {
     627        int64_t unused;
     628        WASM_PARSER_FAIL_IF(!parseVarInt64(unused), "can't get immediate for ", m_currentOpcode, " in unreachable context");
     629        return { };
     630    }
     631
    622632    case GrowMemory:
    623633    case CurrentMemory: {
Note: See TracChangeset for help on using the changeset viewer.