Compare commits

...

1 Commits

Author SHA1 Message Date
Claude
0d517018e7 fix(socket): handle non-object argument in Listener.getsockname
`Listener.getsockname` assumes its first argument is an object and calls
`.put()` on it directly. When a non-object value (e.g. a number) or no
argument is passed, `getObject()` in the C++ binding returns null,
causing a null pointer dereference in `JSC__JSValue__putBunString`.

Check if the argument is an object and fall back to creating a new empty
object if it is not.

https://claude.ai/code/session_014JfaCgPkfj9uHH3HWoQZu9
2026-02-20 22:10:12 +00:00

View File

@@ -850,7 +850,8 @@ pub fn getsockname(this: *Listener, globalThis: *jsc.JSGlobalObject, callFrame:
return .js_undefined;
}
const out = callFrame.argumentsAsArray(1)[0];
const arg = callFrame.argumentsAsArray(1)[0];
const out = if (arg.isObject()) arg else JSValue.createEmptyObject(globalThis, 3);
const socket = this.listener.uws;
var buf: [64]u8 = [_]u8{0} ** 64;