mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Fix for renaming stack variable causing invalid storage error
This commit is contained in:
parent
37298e9b1d
commit
5f9b93c064
1 changed files with 4 additions and 10 deletions
|
@ -300,12 +300,9 @@ public class HighFunctionDBUtil {
|
||||||
* database which conflict with this variable and return
|
* database which conflict with this variable and return
|
||||||
* one of them for re-use. The returned variable still
|
* one of them for re-use. The returned variable still
|
||||||
* exists within the function at the same first-use-offset.
|
* exists within the function at the same first-use-offset.
|
||||||
* @throws InvalidInputException
|
* @returns existing variable with identical storage and first-use offset or null
|
||||||
* @returns variable with conflicting storage or null, all
|
|
||||||
* aspects of variable returned should be reset (i.e., name, datatype and storage)
|
|
||||||
*/
|
*/
|
||||||
private static Variable clearConflictingLocalVariables(HighLocal local)
|
private static Variable clearConflictingLocalVariables(HighLocal local) {
|
||||||
throws InvalidInputException {
|
|
||||||
|
|
||||||
if (local instanceof HighParam) {
|
if (local instanceof HighParam) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
@ -344,10 +341,7 @@ public class HighFunctionDBUtil {
|
||||||
VariableStorage otherStorage = otherVar.getVariableStorage();
|
VariableStorage otherStorage = otherVar.getVariableStorage();
|
||||||
|
|
||||||
if (otherStorage.intersects(storage)) {
|
if (otherStorage.intersects(storage)) {
|
||||||
if (matchingVariable == null || otherStorage.equals(storage)) {
|
if (matchingVariable == null && otherStorage.equals(storage)) {
|
||||||
if (matchingVariable != null) {
|
|
||||||
func.removeVariable(matchingVariable);
|
|
||||||
}
|
|
||||||
matchingVariable = otherVar;
|
matchingVariable = otherVar;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +454,7 @@ public class HighFunctionDBUtil {
|
||||||
Variable var = clearConflictingLocalVariables(local);
|
Variable var = clearConflictingLocalVariables(local);
|
||||||
if (dataType == null) {
|
if (dataType == null) {
|
||||||
if (var != null) {
|
if (var != null) {
|
||||||
dataType = var.getDataType(); // Use preexisting datatype
|
dataType = var.getDataType(); // Use preexisting datatype if it fits in desired storage
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dataType = Undefined.getUndefinedDataType(variable.getSize());
|
dataType = Undefined.getUndefinedDataType(variable.getSize());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue