mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-3261 Strip PartialUnion in NoisyStructureBuilder
This commit is contained in:
@@ -19,6 +19,8 @@ import java.util.Iterator;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import ghidra.program.model.pcode.PartialUnion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a structure from a "noisy" source of field information.
|
* Build a structure from a "noisy" source of field information.
|
||||||
* Feed it field records, either via addDataType(), when we
|
* Feed it field records, either via addDataType(), when we
|
||||||
@@ -92,6 +94,11 @@ public class NoisyStructureBuilder {
|
|||||||
dt = manager.getPointer(DataType.DEFAULT, dt.getLength());
|
dt = manager.getPointer(DataType.DEFAULT, dt.getLength());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (dt instanceof PartialUnion) {
|
||||||
|
// The decompiler can produce the internal data-type PartialUnion, which must
|
||||||
|
// be replaced with a suitable formal data-type within the structure being built
|
||||||
|
dt = ((PartialUnion) dt).getStrippedDataType();
|
||||||
|
}
|
||||||
computeMax(offset, dt.getLength());
|
computeMax(offset, dt.getLength());
|
||||||
Entry<Long, DataType> firstEntry = checkForOverlap(offset, dt.getLength());
|
Entry<Long, DataType> firstEntry = checkForOverlap(offset, dt.getLength());
|
||||||
if (firstEntry != null) {
|
if (firstEntry != null) {
|
||||||
|
|||||||
@@ -119,4 +119,11 @@ public class PartialUnion extends AbstractDataType {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a data-type that can be used as a formal replacement for this (internal) data-type
|
||||||
|
* @return a replacement data-type
|
||||||
|
*/
|
||||||
|
public DataType getStrippedDataType() {
|
||||||
|
return Undefined.getUndefinedDataType(size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user