mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-1963 handle default pointer replacement
This commit is contained in:
parent
2a34f206e9
commit
c38f2022a0
1 changed files with 10 additions and 1 deletions
|
@ -129,7 +129,8 @@ public class FixElfExternalOffsetDataRelocationScript extends GhidraScript {
|
|||
}
|
||||
|
||||
DataType dt = data.getDataType();
|
||||
boolean isDefaultTypeApplied = Undefined.isUndefined(dt);
|
||||
boolean isDefaultTypeApplied = address.equals(data.getAddress()) &&
|
||||
(Undefined.isUndefined(dt) || isDefaultPointer(dt));
|
||||
int componentOffset = (int) address.subtract(data.getAddress());
|
||||
if (!isDefaultTypeApplied &&
|
||||
!canFixupStructure(dt, componentOffset, address.getPointerSize())) {
|
||||
|
@ -175,6 +176,14 @@ public class FixElfExternalOffsetDataRelocationScript extends GhidraScript {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean isDefaultPointer(DataType dt) {
|
||||
if (dt instanceof Pointer) {
|
||||
DataType refDt = ((Pointer) dt).getDataType();
|
||||
return refDt == null || refDt == DataType.DEFAULT;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canFixupStructure(DataType dt, int componentOffset, int pointerLength) {
|
||||
if (!(dt instanceof Structure)) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue