MarshallOfSound

#50119: fix: correct parsing of second-instance additionalData

Merged
Created: Mar 8, 2026, 12:52:20 AM
Merged: Mar 8, 2026, 5:39:13 PM
9 comments
Target: main

Description

Fixes two parsing issues in the app.requestSingleInstanceLock / second-instance data path:

POSIX (process_singleton_posix.cc): The socket message parser did not check the return value of base::StringToSizeT when reading the argv count and additional-data length fields, and did not validate those counts against the actual number of tokens received. A malformed message from a second instance could produce incorrect slicing.

Windows (chrome_process_finder.cc / process_singleton_win.cc): additionalData bytes were reinterpret_cast directly into the null-delimited wchar_t buffer used for WM_COPYDATA. V8's serialization format regularly contains 0x00 bytes (varint-encoded zero lengths, etc.), and any aligned 0x0000 pair terminated the field early on the receive side. The result: complex additionalData objects could arrive truncated and fail to deserialize, while simple ones happened to work. Now base64-encoded before embedding.

Checklist

  • PR description included
  • npm test passes (app.requestSingleInstanceLock suite — 11/11)
  • Follows the PR guidelines

Release Notes

Notes: Fixed an issue where additionalData passed to app.requestSingleInstanceLock on Windows could be truncated or fail to deserialize in the primary instance's second-instance event.

Backports

38-x-y
Merged
PR Number
#50177
Merged At
Mar 9, 2026, 11:59:29 PM
Released In
Not yet
Release Date
Not yet
39-x-y
Merged
PR Number
#50174
Merged At
Mar 10, 2026, 4:10:51 AM
Released In
Not yet
Release Date
Not yet
40-x-y
Merged
PR Number
#50162
Merged At
Mar 10, 2026, 3:42:27 AM
Released In
Not yet
Release Date
Not yet
41-x-y
Merged
PR Number
#50154
Merged At
Mar 9, 2026, 9:22:57 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron