src: use non-deprecated v8::Uint8Array::kMaxLength

PR-URL: https://github.com/nodejs/node/pull/50115
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Michaël Zasso 2023-09-28 15:03:19 +02:00
parent 7166986626
commit 1528846ada
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
2 changed files with 6 additions and 4 deletions

View File

@ -29,7 +29,7 @@ namespace node {
namespace Buffer {
static const size_t kMaxLength = v8::TypedArray::kMaxLength;
static const size_t kMaxLength = v8::Uint8Array::kMaxLength;
typedef void (*FreeCallback)(char* data, void* hint);

View File

@ -5,6 +5,7 @@
#include "debug_utils-inl.h"
#include "env.h"
#include "node_buffer.h"
#include "v8.h"
// Use ostringstream to print exact-width integer types
@ -220,9 +221,10 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env,
inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
char message[128];
snprintf(message, sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",
v8::TypedArray::kMaxLength);
snprintf(message,
sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",
Buffer::kMaxLength);
return ERR_BUFFER_TOO_LARGE(isolate, message);
}