Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r220894 - WebAssembly: const in unreachable code decoded incorr…
…ectly, 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):
- Loading branch information
1 parent
1e683b5
commit 09e314d
Showing
6 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const file = "175693.wasm"; | ||
|
||
if (typeof console === 'undefined') { | ||
console = { log: print }; | ||
} | ||
var binary; | ||
if (typeof process === 'object' && typeof require === 'function' /* node.js detection */) { | ||
var args = process.argv.slice(2); | ||
binary = require('fs').readFileSync(file); | ||
if (!binary.buffer) binary = new Uint8Array(binary); | ||
} else { | ||
var args; | ||
if (typeof scriptArgs != 'undefined') { | ||
args = scriptArgs; | ||
} else if (typeof arguments != 'undefined') { | ||
args = arguments; | ||
} | ||
if (typeof readbuffer === 'function') { | ||
binary = new Uint8Array(readbuffer(file)); | ||
} else { | ||
binary = read(file, 'binary'); | ||
} | ||
} | ||
var instance = new WebAssembly.Instance(new WebAssembly.Module(binary), {}); | ||
if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer(); | ||
try { | ||
console.log('calling: func_0'); | ||
instance.exports.func_0(); | ||
} catch (e) { | ||
console.log(' exception: ' + e); | ||
} | ||
if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer(); | ||
try { | ||
console.log('calling: hangLimitInitializer'); | ||
instance.exports.hangLimitInitializer(); | ||
} catch (e) { | ||
console.log(' exception: ' + e); | ||
} | ||
console.log('done.') |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters