mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 23:17:03 +08:00
GP-1956 corrected improper pointer mask error check for segmented
address space.
This commit is contained in:
+1
-1
@@ -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();
|
||||||
|
|||||||
+7
-3
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user