mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-26 22:21:52 +00:00
GP-1778 fixing bug introduced by changes in GP-1778
This commit is contained in:
parent
d003cf532f
commit
e8ad3efcda
@ -921,6 +921,20 @@ public abstract class AbstractAddressRangeMapTest extends AbstractGhidraHeadedIn
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearRangeThatEndsAtMaxAddress() {
|
||||
AddressRange range1 = range(spaceMax.subtract(0x100), spaceMax);
|
||||
|
||||
map.paintRange(range1.getMinAddress(), range1.getMaxAddress(), ONE);
|
||||
assertEquals(1, map.getRecordCount());
|
||||
assertEquals(1, getMapRanges().size());
|
||||
assertEquals(range1, getMapRanges().get(0));
|
||||
|
||||
map.clearRange(addr(0), spaceMax);
|
||||
List<AddressRange> ranges = getMapRanges();
|
||||
assertEquals(0, ranges.size());
|
||||
}
|
||||
|
||||
private AddressRange range(Address start, Address end) {
|
||||
return new AddressRangeImpl(start, end);
|
||||
}
|
||||
|
@ -752,15 +752,16 @@ public class AddressRangeMapDB implements DBListener {
|
||||
while (it.hasNext()) {
|
||||
DBRecord record = it.next();
|
||||
it.delete(); // all the records that start in the paint region need to be deleted
|
||||
Address endAddress = getEndAddress(record);
|
||||
if (endAddress.compareTo(endAddr) >= 0) {
|
||||
Address recordEndAddress = getEndAddress(record);
|
||||
if (recordEndAddress.compareTo(endAddr) > 0) {
|
||||
Field recordValue = getValue(record);
|
||||
if (recordValue.equals(value)) {
|
||||
// since the last record has same value, it extends our paintRange
|
||||
return endAddress;
|
||||
return recordEndAddress;
|
||||
}
|
||||
// the last record extended past the paint range, create a remainder record
|
||||
createRecord(endAddr.add(1), endAddress, recordValue);
|
||||
// the last record extended past the paint range with a different value,
|
||||
// create a remainder record
|
||||
createRecord(endAddr.add(1), recordEndAddress, recordValue);
|
||||
}
|
||||
}
|
||||
return endAddr;
|
||||
|
Loading…
Reference in New Issue
Block a user