Ghidra is a software reverse engineering (SRE) framework
9303: aligning fix with #9188
Paul Galbraith00320b3a62b1
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.javaindex 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();}