firefox wasm js-string builtin fromcharcodearray triggers stack oob write via stablewasmarrayobjectelements\<uint16\_t\> std::copy byte/element mismatch
Categories
(Core :: JavaScript: WebAssembly, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr140 | --- | unaffected |
| firefox148 | --- | unaffected |
| firefox149 | --- | unaffected |
| firefox150 | --- | unaffected |
People
(Reporter: 1seal, Unassigned)
References
(Blocks 2 open bugs)
Details
(Keywords: ai-involved, csectype-bounds, reporter-external)
Attachments
(3 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Steps to reproduce:
version:
trunk/nightly (gecko-dev commit 5836a062726f715fda621338a17b51aff30d0a8c)
what did you do? (steps to reproduce)
- build a spidermonkey
jsshell from gecko-dev commit5836a062726f715fda621338a17b51aff30d0a8cwith asan enabled (recommended to make the memory corruption observable). - attach
poc.zip. - reproduce:
unzip -q -o poc.zip -d poc && cd poc/poc-F-MOZILLA-FIREFOX-WASM-ARRAY-OOB-001SM_JS=/path/to/js bash ./canonical.sh- (negative control)
SM_JS=/path/to/js bash ./control.sh
- if the build requires prefs for these features, run the shell with:
--setpref wasm_gc=true --setpref wasm_js_string_builtins=true
Actual results:
asan reports a deterministic stack out-of-bounds write when the fallback path is taken:
AddressSanitizer: stack-buffer-overflowWRITE of size 2- top frames include
js::StableWasmArrayObjectElements<unsigned short>::StableWasmArrayObjectElements(...)andjs::wasm::Instance::stringFromCharCodeArray(...)
Expected results:
no out-of-bounds write; fallback path should copy exactly numElements uint16_t elements (not iterate in bytes), and should not copy the inline data header bytes into the element stream.
| Reporter | ||
Comment 1•5 months ago
|
||
| Reporter | ||
Comment 2•5 months ago
|
||
Comment 3•5 months ago
|
||
https://github.com/mozilla/gecko-dev is archived and has not been updated in eight months. As that archive itself says, use https://github.com/mozilla-firefox/firefox instead. The specific code you reference here no longer exists in the current codebase.
Comment 4•5 months ago
|
||
Ryan: you removed this code in bug 2013616, but that was to fix a regression from bug 2005437 in nightly 148. The reporter appears to be testing code from early 142 so if there's a real problem here it might still exist in ESR-140.x also. Does it?
Updated•4 months ago
|
Comment 5•4 months ago
|
||
The description of the issue with std::copy is exactly bug 1992130. The fixed code was uplifted to ESR140 [1]. Bug 1992130 lists Fx143 as wontfix, so I'm guessing the reporter testing on Fx142 is just in the gap before it was fixed.
Updated•4 months ago
|
Updated•4 months ago
|
Updated•4 months ago
|
Updated•2 months ago
|
Description
•