RFR: 8299340: CreateProcessW lpCommandLine must be mutable

Roger Riggs rriggs at openjdk.org
Fri May 12 17:38:50 UTC 2023


Launching of processes on Windows using `ProcessCreateW` with a Unicode character set requires the buffer to be writable. An access violation might occur if `ProcessCreateW` writes to the command line string. The current implementation fetches the command line string using JNI GetStringChars returning a buffer that should not be modified. The code is unchanged since 2015.  There have not been any reported faults in that time.

This change copies the command line to a separately allocation mutable buffer to satisfy the Windows requirement.

-------------

Commit messages:
 - 8299340: CreateProcessW lpCommandLine must be mutable

Changes: https://git.openjdk.org/jdk/pull/13894/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13894&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8299340
  Stats: 17 lines in 1 file changed: 9 ins; 0 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/13894.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13894/head:pull/13894

PR: https://git.openjdk.org/jdk/pull/13894


More information about the core-libs-dev mailing list