From bf1f42fc4302612f111dae3f98c3c1f7c039ce9a Mon Sep 17 00:00:00 2001 From: Paul Galbraith Date: Mon, 22 Jun 2026 14:33:19 -0400 Subject: [PATCH 1/2] 9303: Varnode.High NP gate in ForceUnionAction.findUnion --- .../app/plugin/core/decompile/actions/ForceUnionAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java index 022edfad8b..fd81141ce0 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java @@ -68,7 +68,7 @@ public class ForceUnionAction extends AbstractDecompilerAction { } } Varnode vn = tokenAtCursor.getVarnode(); - if (vn != null) { + if (vn != null && vn.getHigh() != null) { DataType dt = vn.getHigh().getDataType(); if (dt instanceof TypeDef) { dt = ((TypeDef) dt).getBaseDataType(); From 00320b3a62b1046e203fa722a04388525500cbd1 Mon Sep 17 00:00:00 2001 From: Paul Galbraith Date: Wed, 24 Jun 2026 11:36:26 -0400 Subject: [PATCH 2/2] 9303: aligning fix with #9188 --- .../core/decompile/actions/ForceUnionAction.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java index fd81141ce0..90ae12f7e0 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java @@ -68,8 +68,15 @@ public class ForceUnionAction extends AbstractDecompilerAction { } } Varnode vn = tokenAtCursor.getVarnode(); - if (vn != null && vn.getHigh() != null) { - DataType dt = vn.getHigh().getDataType(); + if (vn != null) { + // Some Varnodes -- volatile-memory loads in particular -- never get + // a HighVariable assigned during decompile, so getHigh() can be null. + // Same guard pattern as typeIsUnionRelated below. + HighVariable high = vn.getHigh(); + if (high == null) { + return null; + } + DataType dt = high.getDataType(); if (dt instanceof TypeDef) { dt = ((TypeDef) dt).getBaseDataType(); }