From 6a73a96f6965de8fe0df7e7a59b0642db6b6f85c Mon Sep 17 00:00:00 2001 From: K900 Date: Thu, 18 Dec 2025 10:27:58 +0300 Subject: [PATCH] nodejs_24: apply another patch for 32-bit platforms This may be necessary to apply to other branches as well. --- .../web/nodejs/sab-test-32bit.patch | 27 +++++++++++++++++++ pkgs/development/web/nodejs/v24.nix | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/development/web/nodejs/sab-test-32bit.patch diff --git a/pkgs/development/web/nodejs/sab-test-32bit.patch b/pkgs/development/web/nodejs/sab-test-32bit.patch new file mode 100644 index 000000000000..c90e36b1df6c --- /dev/null +++ b/pkgs/development/web/nodejs/sab-test-32bit.patch @@ -0,0 +1,27 @@ +diff --git a/test/parallel/test-internal-util-construct-sab.js b/test/parallel/test-internal-util-construct-sab.js +index 5ff9b09f8e7d36..403b59809e47d2 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); + } diff --git a/pkgs/development/web/nodejs/v24.nix b/pkgs/development/web/nodejs/v24.nix index cfe3c00b1cdd..09ce2e3e28af 100644 --- a/pkgs/development/web/nodejs/v24.nix +++ b/pkgs/development/web/nodejs/v24.nix @@ -71,5 +71,7 @@ buildNodejs { ++ lib.optionals stdenv.is32bit [ # see: https://github.com/nodejs/node/issues/58458 ./v24-32bit.patch + # see: https://github.com/nodejs/node/issues/61025 + ./sab-test-32bit.patch ]; }