diff options
author | Zach Bjornson <zbbjornson@gmail.com> | 2019-03-18 21:27:13 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-08-17 08:09:27 +0300 |
commit | 0bbda5e5aede9b264a3c6188529c9dbed1ec9719 (patch) | |
tree | d5b87a4fe8a7e9e12f91fc71f983c5d0a661c33d /src/util.h | |
parent | 91a4cb71753b7c7012022e3e67c7a1f16f3b5e80 (diff) |
fs: allow int64 offset in fs.read/readSync/fd.read
Since v10.10.0, 'buf' can be any DataView, meaning the largest
byteLength can be Float64Array.BYTES_PER_ELEMENT * kMaxLength =
17,179,869,176.
'offset' can now be up to 2**53 - 1. This makes it possible to tile
reads into a large buffer.
Breaking: now throws if read offset is not a safe int, is null or
is undefined.
Fixes https://github.com/nodejs/node/issues/26563
PR-URL: https://github.com/nodejs/node/pull/26572
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h index a94e88f232f..c8bb44721f6 100644 --- a/src/util.h +++ b/src/util.h @@ -184,6 +184,11 @@ void DumpBacktrace(FILE* fp); #define UNREACHABLE(...) \ ERROR_AND_ABORT("Unreachable code reached" __VA_OPT__(": ") __VA_ARGS__) +// ECMA262 20.1.2.6 Number.MAX_SAFE_INTEGER (2^53-1) +constexpr int64_t kMaxSafeJsInteger = 9007199254740991; + +inline bool IsSafeJsInt(v8::Local<v8::Value> v); + // TAILQ-style intrusive list node. template <typename T> class ListNode; |