Ghidra is a software reverse engineering (SRE) framework
GP-3286 allow larger custom param size in function editor
ghidra1cf17f27a5b19
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/FunctionEditorModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/FunctionEditorModel.javaindex 4940221a1c..0010138747 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/FunctionEditorModel.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/FunctionEditorModel.java@@ -227,10 +227,10 @@ public class FunctionEditorModel {returnDataTypeSize + "-bytes)";return false;}- else if (storageSize > returnDataTypeSize) {- statusText = "Too much Return Storage (" + storageSize + "-bytes) for datatype (" +- returnDataTypeSize + "-bytes)";- return false;+ else if (storageSize > returnDataTypeSize && storageSize <= 8 && returnDataTypeSize <= 8 &&+ Undefined.isUndefined(returnInfo.getDataType())) {+ // grow undefined type size if needed+ returnInfo.setFormalDataType(Undefined.getUndefinedDataType(storageSize));}return true;}@@ -298,20 +298,20 @@ public class FunctionEditorModel {return true; // don't constrain float storage size}- int requiredSize = datatype.getLength();+ int paramSize = datatype.getLength();- if (storageSize < requiredSize) {+ if (storageSize < paramSize) {statusText = "Insufficient storage (" + storageSize + "-bytes) for datatype (" +- requiredSize + "-bytes) assigned to parameter " + (param.getOrdinal() + 1);+ paramSize + "-bytes) assigned to parameter " + (param.getOrdinal() + 1);return false;}- else if (requiredSize == 0) {+ else if (paramSize == 0) {// assume 0-sized structure which we need to allow}- else if (storageSize > requiredSize) {- statusText = "Too much storage (" + storageSize + "-bytes) for datatype (" +- requiredSize + "-bytes) assigned to parameter " + (param.getOrdinal() + 1);- return false;+ else if (storageSize > paramSize && storageSize <= 8 && paramSize <= 8 &&+ Undefined.isUndefined(param.getDataType())) {+ // grow undefined type size if needed+ param.setFormalDataType(Undefined.getUndefinedDataType(storageSize));}return true;}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/StorageAddressModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/StorageAddressModel.javaindex 3f3cb14dfb..36e7f46ea2 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/StorageAddressModel.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/StorageAddressModel.java@@ -201,18 +201,15 @@ class StorageAddressModel {int currentSize = getCurrentSize();if (currentSize == 0) {statusText = "No storage has been allocated";-// return false;}else if (currentSize > 0 && unconstrained) {return true;}else if (currentSize < requiredSize) {statusText = "Warning: Not enough storage space allocated";-// return false;}else if (currentSize > requiredSize) {statusText = "Warning: Too much storage space allocated";-// return false;}return true;}