fetch: avoid aliasing cloned body buffers - #31617
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR fixes a memory aliasing bug in blob data transfer by conditionally copying shared backing stores during ChangesResponse body aliasing safety
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
846db95 to
dcdb339
Compare
|
Thanks for the fix and the tests. The same change landed on main in #33072 (merged July 4): I checked this PR's four Closing since there is nothing left for this PR to change. If you still see aliasing on a current canary ( |
Summary
Addresses #22885.
Cloned response bodies exposed shared backing storage through
arrayBuffer()andbytes(). This copies shared stores before creating mutable JS buffers, keeping the zero-copy transfer path for uniquely owned stores.Changes:
arrayBuffer()andbytes()Credits
Thanks to @ChALkeR for the spec analysis and reproduction.
Verification
Review map
Blob.rs: shared-store guard in theLifetime::Transferpath beforetake_store()body-clone.test.ts: Response clone regressions forarrayBuffer(),bytes(), sibling clone isolation, and sole-owner fast path