aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-28 21:57:31 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-28 21:57:31 -0700
commit8984c819613b52b3cfaf1cd22fc059d0150eedfc (patch)
tree938c607470095f60a07489003ce0c8db5c7c8768 /src
parentc6f6db95ffbbf13a68939f7c3de544b1285e8929 (diff)
downloadbun-8984c819613b52b3cfaf1cd22fc059d0150eedfc.tar.gz
bun-8984c819613b52b3cfaf1cd22fc059d0150eedfc.tar.zst
bun-8984c819613b52b3cfaf1cd22fc059d0150eedfc.zip
Prevent integer overflow
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/bindings.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig
index 2b800ab8b..1c09378a8 100644
--- a/src/bun.js/bindings/bindings.zig
+++ b/src/bun.js/bindings/bindings.zig
@@ -4608,7 +4608,7 @@ pub const JSValue = enum(JSValueReprInt) {
return 0;
}
- return @intFromFloat(u64, @max(len, 0));
+ return @intFromFloat(u64, @max(@min(len, std.math.maxInt(i52)), 0));
}
/// This function supports:
@@ -4629,7 +4629,7 @@ pub const JSValue = enum(JSValueReprInt) {
return null;
}
- return @intFromFloat(u64, @max(len, 0));
+ return @intFromFloat(u64, @max(@min(len, std.math.maxInt(i52)), 0));
}
/// Do not use this directly!