forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1762658 - wasm: Add CacheableName to support names with null term…
…inator before end. r=yury A WebAssembly 'name' is a length terminated sequence of UTF-8 characters. This implies that '\0' can show up in a string before the end, and we cannot treat them like c-strings. A new CacheableName struct is added to support this. CacheableChars is still used in unrelated areas and left as-is. The test importer is extended to handle escaping unusual unicode sequences better, and names.wast is now imported. Differential Revision: https://phabricator.services.mozilla.com/D147365
- Loading branch information
Showing
13 changed files
with
2,486 additions
and
112 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
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,20 @@ | ||
// An export name may contain a null terminator | ||
let exports = wasmEvalText(`(module | ||
(func) | ||
(export "\\00first" (func 0)) | ||
(export "\\00second" (func 0)) | ||
)`).exports; | ||
assertEq(exports["\0first"] instanceof Function, true); | ||
assertEq(exports["\0second"] instanceof Function, true); | ||
|
||
// An import name may contain a null terminator | ||
let imports = { | ||
"\0module": { | ||
"\0field": 10, | ||
} | ||
}; | ||
let {global} = wasmEvalText(`(module | ||
(import "\\00module" "\\00field" (global i32)) | ||
(export "global" (global 0)) | ||
)`, imports).exports; | ||
assertEq(global.value, 10); |
Oops, something went wrong.