WebKit Bugzilla
Attachment 343068 Details for
Bug 186794
: Wasm: Any function argument of type Void should be a validation error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for landing
a-backup.diff (text/plain), 4.87 KB, created by
Saam Barati
on 2018-06-19 11:09:52 PDT
(
hide
)
Description:
patch for landing
Filename:
MIME Type:
Creator:
Saam Barati
Created:
2018-06-19 11:09:52 PDT
Size:
4.87 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 232967) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2018-06-19 Saam Barati <sbarati@apple.com> >+ >+ Wasm: Any function argument of type Void should be a validation error >+ https://bugs.webkit.org/show_bug.cgi?id=186794 >+ <rdar://problem/41140257> >+ >+ Reviewed by Keith Miller. >+ >+ * wasm/Builder.js: >+ (const._normalizeFunctionSignature): >+ * wasm/function-tests/void-argument-type-should-be-a-validation-error.js: Added. >+ (getBinary): >+ * wasm/self-test/test_BuilderJSON.js: >+ > 2018-06-18 Keith Miller <keith_miller@apple.com> > > Properly zero unused property storage offsets >Index: JSTests/wasm/Builder.js >=================================================================== >--- JSTests/wasm/Builder.js (revision 232953) >+++ JSTests/wasm/Builder.js (working copy) >@@ -44,7 +44,7 @@ const _unknownSectionId = 0; > const _normalizeFunctionSignature = (params, ret) => { > assert.isArray(params); > for (const p of params) >- assert.truthy(WASM.isValidValueType(p), `Type parameter ${p} needs a valid value type`); >+ assert.truthy(WASM.isValidValueType(p) || p === "void", `Type parameter ${p} needs a valid value type`); > if (typeof(ret) === "undefined") > ret = "void"; > assert.isNotArray(ret, `Multiple return values not supported by WebAssembly yet`); >Index: JSTests/wasm/function-tests/void-argument-type-should-be-a-validation-error.js >=================================================================== >--- JSTests/wasm/function-tests/void-argument-type-should-be-a-validation-error.js (nonexistent) >+++ JSTests/wasm/function-tests/void-argument-type-should-be-a-validation-error.js (working copy) >@@ -0,0 +1,22 @@ >+import * as assert from '../assert.js'; >+import Builder from '../Builder.js'; >+ >+function getBinary(params) { >+ const builder = (new Builder()) >+ builder.Type().End() >+ .Function().End() >+ .Memory().InitialMaxPages(1, 1).End() >+ .Export() >+ .Function("callFunc") >+ .End() >+ .Code() >+ .Function("callFunc", { params, ret: "void" }) >+ .Return() >+ .End() >+ .End(); >+ return builder.WebAssembly().get(); >+} >+ >+assert.throws(() => new WebAssembly.Module(getBinary(["i32", "void"])), WebAssembly.CompileError, "WebAssembly.Module doesn't parse at byte 15 / 47: can't get 1th argument Type"); >+assert.throws(() => new WebAssembly.Module(getBinary(["void"])), WebAssembly.CompileError, "WebAssembly.Module doesn't parse at byte 14 / 46: can't get 0th argument Type"); >+assert.throws(() => new WebAssembly.Module(getBinary(["i32", "void", "i32"])), WebAssembly.CompileError, "WebAssembly.Module doesn't parse at byte 15 / 48: can't get 1th argument Type"); >Index: JSTests/wasm/self-test/test_BuilderJSON.js >=================================================================== >--- JSTests/wasm/self-test/test_BuilderJSON.js (revision 232953) >+++ JSTests/wasm/self-test/test_BuilderJSON.js (working copy) >@@ -349,7 +349,7 @@ const assertOpThrows = (opFn, message) = > })(); > > (function InvalidFunctionParameters() { >- for (let invalid of ["", "void", "bool", "any", "struct", 0, 3.14, undefined, [], {}]) { >+ for (let invalid of ["", "bool", "any", "struct", 0, 3.14, undefined, [], {}]) { > const c = (new Builder()).Code(); > assert.throws(() => c.Function({ params: [invalid] }), Error, `Expected truthy: Type parameter ${invalid} needs a valid value type`); > } >Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 232953) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2018-06-19 Saam Barati <sbarati@apple.com> >+ >+ Wasm: Any function argument of type Void should be a validation error >+ https://bugs.webkit.org/show_bug.cgi?id=186794 >+ <rdar://problem/41140257> >+ >+ Reviewed by Keith Miller. >+ >+ * wasm/WasmModuleParser.cpp: >+ (JSC::Wasm::ModuleParser::parseType): >+ > 2018-06-18 Keith Miller <keith_miller@apple.com> > > Unreviewed, fix the build... >Index: Source/JavaScriptCore/wasm/WasmModuleParser.cpp >=================================================================== >--- Source/JavaScriptCore/wasm/WasmModuleParser.cpp (revision 232953) >+++ Source/JavaScriptCore/wasm/WasmModuleParser.cpp (working copy) >@@ -126,7 +126,7 @@ auto ModuleParser::parseType() -> Partia > > for (unsigned i = 0; i < argumentCount; ++i) { > Type argumentType; >- WASM_PARSER_FAIL_IF(!parseResultType(argumentType), "can't get ", i, "th argument Type"); >+ WASM_PARSER_FAIL_IF(!parseValueType(argumentType), "can't get ", i, "th argument Type"); > signature->argument(i) = argumentType; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186794
:
343002
|
343004
|
343016
|
343028
| 343068