aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-17 05:46:44 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-17 05:46:44 -0700
commitd19005aa762b55114d26dabe4931a8c8aa3bfaae (patch)
treef721e70bb0b37f982a25bc686bb528190a9c6407
parentd2c64300f61d0eedf86017396dbfa56db0200bfb (diff)
downloadbun-d19005aa762b55114d26dabe4931a8c8aa3bfaae.tar.gz
bun-d19005aa762b55114d26dabe4931a8c8aa3bfaae.tar.zst
bun-d19005aa762b55114d26dabe4931a8c8aa3bfaae.zip
Fix access of inactive union field
-rw-r--r--src/bun.js/api/server.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig
index 1390a4aa8..40a78f5c2 100644
--- a/src/bun.js/api/server.zig
+++ b/src/bun.js/api/server.zig
@@ -5003,13 +5003,14 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type {
},
};
resp.onData(*RequestContext, RequestContext.onBufferedBodyChunk, ctx);
- } else {
- // no content-length or 0 content-length
- // no transfer-encoding
+ } else if (request_object.body == .Locked) {
+ // This branch should never be taken, but we are handling it anyway.
var old = request_object.body;
old.Locked.onReceiveValue = null;
request_object.body = .{ .Null = {} };
old.resolve(&request_object.body, this.globalThis);
+ } else {
+ request_object.body = .{ .Null = {} };
}
}