mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-1956 corrected improper pointer mask error check for segmented
address space.
This commit is contained in:
parent
47f76c78d6
commit
da570d5d14
2 changed files with 8 additions and 4 deletions
|
@ -35,7 +35,7 @@ public class OffsetMaskSettingsDefinition
|
||||||
private static final String DISPLAY_NAME = "Offset Mask";
|
private static final String DISPLAY_NAME = "Offset Mask";
|
||||||
private static BigInteger MAX_VALUE = new BigInteger("0ffffffffffffffff", 16);
|
private static BigInteger MAX_VALUE = new BigInteger("0ffffffffffffffff", 16);
|
||||||
|
|
||||||
private static final long DEFAULT = -1; // unsigned mask - all bits are ones
|
public static final long DEFAULT = -1; // unsigned mask - all bits are ones
|
||||||
|
|
||||||
public static final OffsetMaskSettingsDefinition DEF =
|
public static final OffsetMaskSettingsDefinition DEF =
|
||||||
new OffsetMaskSettingsDefinition();
|
new OffsetMaskSettingsDefinition();
|
||||||
|
|
|
@ -411,7 +411,11 @@ public class PointerDataType extends BuiltIn implements Pointer {
|
||||||
long addrOffset = offset;
|
long addrOffset = offset;
|
||||||
|
|
||||||
long mask = OffsetMaskSettingsDefinition.DEF.getValue(settings);
|
long mask = OffsetMaskSettingsDefinition.DEF.getValue(settings);
|
||||||
if (mask != 0) {
|
if (mask == 0) {
|
||||||
|
errorHandler.accept("Invalid pointer mask: 0");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (mask != OffsetMaskSettingsDefinition.DEFAULT) {
|
||||||
addrOffset &= mask;
|
addrOffset &= mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +428,7 @@ public class PointerDataType extends BuiltIn implements Pointer {
|
||||||
addrOffset >>>= -shift; // unsigned right-shift
|
addrOffset >>>= -shift; // unsigned right-shift
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if (shift > 0) {
|
||||||
addrOffset <<= shift; // left-shift
|
addrOffset <<= shift; // left-shift
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +508,7 @@ public class PointerDataType extends BuiltIn implements Pointer {
|
||||||
errorHandler.accept("Unsupported segmented address size: " + size);
|
errorHandler.accept("Unsupported segmented address size: " + size);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (mask != 0 || shift != 0) {
|
if (mask != OffsetMaskSettingsDefinition.DEFAULT || shift != 0) {
|
||||||
errorHandler.accept("Unsupported mask/shift setting for segmented address");
|
errorHandler.accept("Unsupported mask/shift setting for segmented address");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue