doc: correct values/references for buffer.kMaxLength

PR-URL: https://github.com/nodejs/node/pull/60305
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
René 2025-11-08 15:04:51 +00:00 committed by Antoine du Hamel
parent ea7ecb517b
commit bbc649057c
No known key found for this signature in database
GPG Key ID: 20B1A390B168D356

View File

@ -5376,7 +5376,7 @@ changes:
- version: v22.0.0
pr-url: https://github.com/nodejs/node/pull/52465
description: Value is changed to 2<sup>53</sup> - 1 on 64-bit
architectures.
architectures, and 2<sup>31</sup> - 1 on 32-bit architectures.
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/35415
description: Value is changed to 2<sup>32</sup> on 64-bit
@ -5389,12 +5389,13 @@ changes:
* Type: {integer} The largest size allowed for a single `Buffer` instance.
On 32-bit architectures, this value currently is 2<sup>30</sup> - 1 (about 1
On 32-bit architectures, this value is equal to 2<sup>31</sup> - 1 (about 2
GiB).
On 64-bit architectures, this value currently is 2<sup>53</sup> - 1 (about 8 PiB).
On 64-bit architectures, this value is equal to [`Number.MAX_SAFE_INTEGER`][]
(2<sup>53</sup> - 1, about 8 PiB).
It reflects [`v8::TypedArray::kMaxLength`][] under the hood.
It reflects [`v8::Uint8Array::kMaxLength`][] under the hood.
This value is also available as [`buffer.kMaxLength`][].
@ -5539,6 +5540,7 @@ introducing security vulnerabilities into an application.
[`ERR_INVALID_BUFFER_SIZE`]: errors.md#err_invalid_buffer_size
[`ERR_OUT_OF_RANGE`]: errors.md#err_out_of_range
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
[`String.prototype.indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
[`String.prototype.lastIndexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf
[`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length
@ -5561,7 +5563,7 @@ introducing security vulnerabilities into an application.
[`buffer.constants.MAX_STRING_LENGTH`]: #bufferconstantsmax_string_length
[`buffer.kMaxLength`]: #bufferkmaxlength
[`util.inspect()`]: util.md#utilinspectobject-options
[`v8::TypedArray::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0
[`v8::Uint8Array::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1Uint8Array.html#a7677e3d0c9c92e4d40bef7212f5980c6
[base64url]: https://tools.ietf.org/html/rfc4648#section-5
[endianness]: https://en.wikipedia.org/wiki/Endianness
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols