mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
test: make buffer sizes 32bit-aware in test-internal-util-construct-sab
https://github.com/nodejs/node/pull/61026
This commit is contained in:
@@ -43,3 +43,4 @@ fix_ensure_traverseparent_bails_on_resource_path_exit.patch
|
||||
reland_temporal_unflag_temporal.patch
|
||||
src_handle_der_decoding_errors_from_system_certificates.patch
|
||||
fix_suppress_nodiscard_warning_for_copy_options_operator.patch
|
||||
test_make_buffer_sizes_32bit-aware_in.patch
|
||||
|
||||
38
patches/node/test_make_buffer_sizes_32bit-aware_in.patch
Normal file
38
patches/node/test_make_buffer_sizes_32bit-aware_in.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ren=C3=A9?= <contact.9a5d6388@renegade334.me.uk>
|
||||
Date: Sat, 20 Dec 2025 22:20:21 +0000
|
||||
Subject: test: make buffer sizes 32bit-aware in
|
||||
test-internal-util-construct-sab
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/61026
|
||||
Fixes: https://github.com/nodejs/node/issues/61025
|
||||
Refs: https://github.com/nodejs/node/pull/60497
|
||||
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
|
||||
|
||||
diff --git a/test/parallel/test-internal-util-construct-sab.js b/test/parallel/test-internal-util-construct-sab.js
|
||||
index 5ff9b09f8e7d36a91825a38e861b8c2615c62500..403b59809e47d2e1d3503a059826f66334a2f035 100644
|
||||
--- a/test/parallel/test-internal-util-construct-sab.js
|
||||
+++ b/test/parallel/test-internal-util-construct-sab.js
|
||||
@@ -3,16 +3,20 @@
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
+const { kMaxLength } = require('buffer');
|
||||
const { isSharedArrayBuffer } = require('util/types');
|
||||
const { constructSharedArrayBuffer } = require('internal/util');
|
||||
|
||||
// We're testing that we can construct a SAB even when the global is not exposed.
|
||||
assert.strictEqual(typeof SharedArrayBuffer, 'undefined');
|
||||
|
||||
-for (const length of [undefined, 0, 1, 2 ** 32]) {
|
||||
+for (const length of [undefined, 0, 1, 2 ** 16]) {
|
||||
assert(isSharedArrayBuffer(constructSharedArrayBuffer(length)));
|
||||
}
|
||||
|
||||
-for (const length of [-1, Number.MAX_SAFE_INTEGER + 1, 2 ** 64]) {
|
||||
+// Specifically test the following cases:
|
||||
+// - out-of-range allocation requests should not crash the process
|
||||
+// - no int64 overflow
|
||||
+for (const length of [-1, kMaxLength + 1, 2 ** 64]) {
|
||||
assert.throws(() => constructSharedArrayBuffer(length), RangeError);
|
||||
}
|
||||
Reference in New Issue
Block a user