diff options
author | 2023-03-07 18:32:53 -0800 | |
---|---|---|
committer | 2023-03-07 18:44:48 -0800 | |
commit | 7ac6eab209a536c5c3bb5547ab6f30e9860939d4 (patch) | |
tree | 99222c69da2d216c49bbab3d162e1ce5fc9835a9 | |
parent | 16207d78be0264b8763c165de75d995376f98795 (diff) | |
download | bun-7ac6eab209a536c5c3bb5547ab6f30e9860939d4.tar.gz bun-7ac6eab209a536c5c3bb5547ab6f30e9860939d4.tar.zst bun-7ac6eab209a536c5c3bb5547ab6f30e9860939d4.zip |
Add a few more checks for isNumber()
-rw-r--r-- | src/bun.js/webcore/streams.zig | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 1de209b69..2feddc229 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -399,7 +399,8 @@ pub const StreamStart = union(Tag) { } if (value.get(globalThis, "chunkSize")) |chunkSize| { - return .{ .chunk_size = @intCast(Blob.SizeType, @truncate(i52, chunkSize.toInt64())) }; + if (chunkSize.isNumber()) + return .{ .chunk_size = @intCast(Blob.SizeType, @truncate(i52, chunkSize.toInt64())) }; } return .{ .empty = {} }; @@ -432,8 +433,10 @@ pub const StreamStart = union(Tag) { } if (value.get(globalThis, "highWaterMark")) |chunkSize| { - empty = false; - chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(0, @truncate(i51, chunkSize.toInt64()))); + if (chunkSize.isNumber()) { + empty = false; + chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(0, @truncate(i51, chunkSize.toInt64()))); + } } if (!empty) { @@ -450,7 +453,8 @@ pub const StreamStart = union(Tag) { var chunk_size: JSC.WebCore.Blob.SizeType = 0; if (value.get(globalThis, "highWaterMark")) |chunkSize| { - chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(0, @truncate(i51, chunkSize.toInt64()))); + if (chunkSize.isNumber()) + chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(0, @truncate(i51, chunkSize.toInt64()))); } if (value.get(globalThis, "path")) |path| { @@ -485,8 +489,10 @@ pub const StreamStart = union(Tag) { var chunk_size: JSC.WebCore.Blob.SizeType = 2048; if (value.get(globalThis, "highWaterMark")) |chunkSize| { - empty = false; - chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(256, @truncate(i51, chunkSize.toInt64()))); + if (chunkSize.isNumber()) { + empty = false; + chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(256, @truncate(i51, chunkSize.toInt64()))); + } } if (!empty) { |