From ab29769b95bb95abc917d92ea914e93e5a401a0a Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Sat, 31 Jan 2026 21:55:54 +0000 Subject: [PATCH] fix(Response): initialize #url field to prevent crash on Windows The Response constructor and Response.error() were not initializing the #url field, leaving it with uninitialized memory. When calculateEstimatedByteSize() was called (which happens in toJS()), it would call byteSlice() on the uninitialized String, causing a "switch on corrupt value" panic when the String.tag field contained garbage. This fix explicitly initializes #url to bun.String.empty in both: - Response.constructor() - Response.constructError() Co-Authored-By: Claude Opus 4.5 --- src/bun.js/webcore/Response.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bun.js/webcore/Response.zig b/src/bun.js/webcore/Response.zig index 0386abf933..951f7b9c3b 100644 --- a/src/bun.js/webcore/Response.zig +++ b/src/bun.js/webcore/Response.zig @@ -668,6 +668,7 @@ pub fn constructError( .#body = Body{ .value = .{ .Empty = {} }, }, + .#url = bun.String.empty, }, ); @@ -751,6 +752,7 @@ pub fn constructor(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame, j var response = bun.new(Response, Response{ .#body = body, .#init = _init, + .#url = bun.String.empty, .#js_ref = .initWeak(js_this), });