Repository navigation
fix(wintertc): enforce max_buffer_size and fallible allocation during ArrayBuffer deserialization - #5670
Open
abdulhamid999 wants to merge 1 commit into
Conversation
… ArrayBuffer deserialization In core/wintertc/src/store/to.rs, ry_into_js_array_buffer previously used JsArrayBuffer::from_byte_block(AlignedVec::from_slice(0, data), context), which bypassed CreateByteDataBlock, skipped HostHooks::max_buffer_size, and used an infallible memory reservation. This updates ry_into_js_array_buffer to allocate via JsArrayBuffer::new(data.len(), context)? and copy into data_mut(). This ensures HostHooks::max_buffer_size is properly enforced across structuredClone and postMessage, returning a RangeError when a payload exceeds host caps or memory limits instead of causing an unhandled allocation abort. Fixes boa-dev#5652.
Test262 conformance changes
Broken tests (1):Tested main commit: |
HalidOdat
approved these changes
Nov 14, 2026
Comment on lines
+70
to
+73
| let buffer = JsArrayBuffer::new(data.len(), context)?; | ||
| if let Some(mut data_mut) = buffer.data_mut() { | ||
| data_mut.copy_from_slice(data); | ||
| } |
Member
There was a problem hiding this comment.
remark: consider adding a small concise comment/note why from_byte_block isn't used here.
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request fixes #5652.
It changes the following:
core/wintertc/src/store/to.rs, updatestry_into_js_array_bufferto construct buffers viaJsArrayBuffer::new(data.len(), context)?and copy intodata_mut().HostHooks::max_buffer_size(context)during structured clone (structuredClone) and message deserialization (postMessage), returning aRangeErrorwhen an incoming payload exceeds host-defined buffer limits.AlignedVec::from_slicewith fallible memory reservation viaCreateByteDataBlock, preventing unhandled process aborts on memory exhaustion.core/wintertc/src/store/tests.rscovering:ArrayBufferpayloads againstHostHooks::max_buffer_size.ArrayBufferpayloads.ArrayBufferroundtrip cloning.ArrayBufferroundtrip cloning.