Skip to content

Commit d5e1b82

Browse files
RaisinTendanielleadams
authored andcommitted
fs: accept non-32-bit length in writeBuffer
Since `length` is `size_t`, it can accept 64-bit integers too. Refs: https://man7.org/linux/man-pages/man2/write.2.html Fixes: #36643 PR-URL: #36667 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yash Ladha <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
1 parent 5cb8b16 commit d5e1b82

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node_file.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1832,8 +1832,8 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
18321832
CHECK_LE(static_cast<uint64_t>(off_64), buffer_length);
18331833
const size_t off = static_cast<size_t>(off_64);
18341834

1835-
CHECK(args[3]->IsInt32());
1836-
const size_t len = static_cast<size_t>(args[3].As<Int32>()->Value());
1835+
CHECK(IsSafeJsInt(args[3]));
1836+
const size_t len = static_cast<size_t>(args[3].As<Integer>()->Value());
18371837
CHECK(Buffer::IsWithinBounds(off, len, buffer_length));
18381838
CHECK_LE(len, buffer_length);
18391839
CHECK_GE(off + len, off);

0 commit comments

Comments
 (0)