diff --git a/src/node_file.cc b/src/node_file.cc index 4e975530b2c63c..5abdc6a941c0d2 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1832,8 +1832,8 @@ static void WriteBuffer(const FunctionCallbackInfo& args) { CHECK_LE(static_cast(off_64), buffer_length); const size_t off = static_cast(off_64); - CHECK(args[3]->IsInt32()); - const size_t len = static_cast(args[3].As()->Value()); + CHECK(IsSafeJsInt(args[3])); + const size_t len = static_cast(args[3].As()->Value()); CHECK(Buffer::IsWithinBounds(off, len, buffer_length)); CHECK_LE(len, buffer_length); CHECK_GE(off + len, off);