From 49edebcd82b9a2b2c01edbbc9de6988b7357888c Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Thu, 10 Sep 2026 17:37:05 +0200 Subject: [PATCH] bridge: call setOptions before decompileFunction (fix null options crash) A bare DecompInterface has options==null (the constructor stores null). Without an explicit setOptions call, decompileFunction throws 'IllegalArgumentException: this.options is null' on a fresh bridge, or renders string data as PTR_s_ symbols instead of literals when a stale bridge happens to have options from a prior call. Fix: add DecompInterface.setOptions(new DecompileOptions()) at all three decompiler sites (handleDecompile, handleSetVarType, handleDiffFunctions). --- src/ghidra/scripts/GhidraCliBridge.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ghidra/scripts/GhidraCliBridge.java b/src/ghidra/scripts/GhidraCliBridge.java index 0de4833b..b5e0da69 100644 --- a/src/ghidra/scripts/GhidraCliBridge.java +++ b/src/ghidra/scripts/GhidraCliBridge.java @@ -16,6 +16,7 @@ import ghidra.util.exception.CancelledException; import generic.jar.ResourceFile; import ghidra.app.decompiler.DecompInterface; +import ghidra.app.decompiler.DecompileOptions; import ghidra.app.decompiler.DecompileResults; import ghidra.app.cmd.function.ApplyFunctionSignatureCmd; import ghidra.program.model.pcode.HighFunction; @@ -1489,6 +1490,7 @@ private JsonObject handleDecompile(JsonObject args) { } DecompInterface decompiler = new DecompInterface(); + decompiler.setOptions(new DecompileOptions()); try { decompiler.openProgram(currentProgram); @@ -3890,6 +3892,7 @@ private JsonObject handleSetVarType(JsonObject args) { if (newType == null) return errorResult("Type not found: " + typeName); DecompInterface decompiler = new DecompInterface(); + decompiler.setOptions(new DecompileOptions()); try { decompiler.openProgram(currentProgram); TaskMonitor mon = monitor; @@ -4419,6 +4422,7 @@ private JsonObject handleDiffFunctions(JsonObject args) { if (func2 == null) return errorResult(buildFunctionTargetHint(func2Target)); DecompInterface decompiler = new DecompInterface(); + decompiler.setOptions(new DecompileOptions()); try { decompiler.openProgram(currentProgram); TaskMonitor mon = monitor;