Commit 5a538e1bf45 for nodejs

commit 5a538e1bf4532bbc8de3bed91a977718f74464f7
Author: Roberto Bianchi <roberto.bianchi@spendesk.com>
Date:   Fri Dec 4 00:48:28 2026 +0100

    path: avoid mutable push in join()

    posix.join() and the reserved-name check in win32.join() collected
    segments with .push() on local arrays, which looks up
    Array.prototype.push at call time. Replacing that method from user code
    made path.join() throw or return a wrong path. Use indexed assignments
    instead. win32.join() already uses ArrayPrototypePush for its own
    segment list.

    Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
    PR-URL: https://github.com/nodejs/node/pull/67752
    Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
    Reviewed-By: Jordan Harband <ljharb@gmail.com>
    Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: LiviaMedeiros <livia@cirno.name>

diff --git a/lib/path.js b/lib/path.js
index b371f422b6b..0287e18c2e4 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -578,7 +578,7 @@ const win32 = {

     for (let i = 0; i < joined.length; i++) {
       if (joined[i] === '\\') {
-        if (part) parts.push(part);
+        if (part) parts[parts.length] = part;
         part = '';
         // Skip consecutive backslashes
         while (i + 1 < joined.length && joined[i + 1] === '\\') i++;
@@ -587,7 +587,7 @@ const win32 = {
       }
     }
     // Add the final part if any
-    if (part) parts.push(part);
+    if (part) parts[parts.length] = part;

     // Check if any part has a Windows reserved name
     if (parts.some((p) => {
@@ -1344,7 +1344,7 @@ const posix = {
       const arg = args[i];
       validateString(arg, 'path');
       if (arg.length > 0) {
-        path.push(arg);
+        path[path.length] = arg;
       }
     }