mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 12:11:55 +00:00
GP-0 corrected Data pointer stacking test failures
This commit is contained in:
parent
60fc7a35c2
commit
b3c19de3dd
@ -483,16 +483,17 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||
pdt = (Pointer) dt;
|
||||
assertNull(pdt.getDataType());
|
||||
|
||||
// When default pointer is stacked, the resulting pointer size will match
|
||||
// the outmost pointer size - in this case that is 1-byte
|
||||
cmd = new CreateDataCmd(addr, false, true, new PointerDataType());
|
||||
cmd.applyTo(program);
|
||||
|
||||
d = listing.getDataAt(addr);
|
||||
assertNotNull(d);
|
||||
assertTrue(d.isDefined());
|
||||
assertEquals(addr.getPointerSize(), d.getLength());
|
||||
assertEquals(1, d.getLength());
|
||||
dt = d.getDataType();
|
||||
assertTrue(dt instanceof Pointer);
|
||||
assertEquals(addr.getPointerSize(), dt.getLength());
|
||||
assertEquals(1, dt.getLength());
|
||||
|
||||
pdt = (Pointer) dt;
|
||||
dt = pdt.getDataType();
|
||||
@ -557,16 +558,17 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||
pdt = (Pointer) dt;
|
||||
assertTrue(pdt.getDataType() instanceof ByteDataType);
|
||||
|
||||
// When default pointer is stacked, the resulting pointer size will match
|
||||
// the outmost pointer size - in this case that is 1-byte
|
||||
cmd = new CreateDataCmd(addr, false, true, new PointerDataType());
|
||||
cmd.applyTo(program);
|
||||
|
||||
d = listing.getDataAt(addr);
|
||||
assertNotNull(d);
|
||||
assertTrue(d.isDefined());
|
||||
assertEquals(addr.getPointerSize(), d.getLength());
|
||||
assertEquals(1, d.getLength());
|
||||
dt = d.getDataType();
|
||||
assertTrue(dt instanceof Pointer);
|
||||
assertEquals(addr.getPointerSize(), dt.getLength());
|
||||
assertEquals(1, dt.getLength());
|
||||
|
||||
pdt = (Pointer) dt;
|
||||
dt = pdt.getDataType();
|
||||
@ -630,8 +632,8 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||
|
||||
// Add external reference from pointer
|
||||
program.getReferenceManager()
|
||||
.addExternalReference(addr, "OtherFile", "ExtLabel", null,
|
||||
SourceType.USER_DEFINED, 0, RefType.DATA);
|
||||
.addExternalReference(addr, "OtherFile", "ExtLabel", null, SourceType.USER_DEFINED,
|
||||
0, RefType.DATA);
|
||||
|
||||
// Undefined* becomes Byte*
|
||||
cmd = new CreateDataCmd(addr, false, true, new ByteDataType());
|
||||
|
@ -166,6 +166,10 @@ public final class DataUtilities {
|
||||
Reference extRef = null;
|
||||
if (!isParentData(data, addr)) {
|
||||
|
||||
if (!stackPointers && isDataClearingDenied(existingType, clearMode)) {
|
||||
throw new CodeUnitInsertionException("Could not create Data at address " + addr);
|
||||
}
|
||||
|
||||
existingLength = data.getLength();
|
||||
|
||||
if (data.isDefined()) {
|
||||
@ -185,10 +189,6 @@ public final class DataUtilities {
|
||||
}
|
||||
}
|
||||
|
||||
if (!stackPointers && isDataClearingDenied(existingType, clearMode)) {
|
||||
throw new CodeUnitInsertionException("Could not create Data at address " + addr);
|
||||
}
|
||||
|
||||
// TODO: This can probably be eliminated
|
||||
// Check for external reference on pointer
|
||||
extRef =
|
||||
|
Loading…
Reference in New Issue
Block a user