fix(ghidra): encode Java probe output as UTF-8 (#2206)
* fix(ghidra): encode Java probe output as UTF-8 * fix(ghidra): preserve Unicode Java homes across supported JDKs * test(ghidra): verify snapshot rejection without matching prose --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,7 @@ const WINDOWS_INSTALL = "C:\\tools\\ghidra_12.1.4_PUBLIC";
|
||||
const WINDOWS_PROPERTIES = `${WINDOWS_INSTALL}\\Ghidra\\application.properties`;
|
||||
const WINDOWS_HEADLESS = `${WINDOWS_INSTALL}\\support\\analyzeHeadless.bat`;
|
||||
const WINDOWS_DECOMPILER = `${WINDOWS_INSTALL}\\Ghidra\\Features\\Decompiler\\os\\win_x86_64\\decompile.exe`;
|
||||
|
||||
const JAVA: GhidraJavaObservation = {
|
||||
version: "21.0.11",
|
||||
major: SUPPORTED_GHIDRA_JAVA_MAJOR,
|
||||
@@ -43,7 +44,9 @@ const host = (
|
||||
...overrides,
|
||||
});
|
||||
|
||||
afterEach(() => vi.unstubAllEnvs());
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it("probes the selected Java environment without reading conflicting ambient settings", () => {
|
||||
vi.stubEnv("REA_GHIDRA_CONTEXT", "ambient");
|
||||
|
||||
@@ -734,7 +734,16 @@ const systemGhidraInstallationHost = (): GhidraInstallationHost => ({
|
||||
probeJava(command, environment) {
|
||||
const observed = spawnSync(
|
||||
command,
|
||||
["-XX:-UsePerfData", "-XshowSettings:properties", "-version"],
|
||||
[
|
||||
"-Dstdout.encoding=UTF-8",
|
||||
"-Dstderr.encoding=UTF-8",
|
||||
// JDK 17/18 use the legacy names; JDK 19+ use the names above.
|
||||
"-Dsun.stdout.encoding=UTF-8",
|
||||
"-Dsun.stderr.encoding=UTF-8",
|
||||
"-XX:-UsePerfData",
|
||||
"-XshowSettings:properties",
|
||||
"-version",
|
||||
],
|
||||
{
|
||||
encoding: "utf8",
|
||||
env: environment,
|
||||
|
||||
Reference in New Issue
Block a user