mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GT-3073 fixed bug in put byte when there is more than one sub block in a
memory block
This commit is contained in:
parent
e36b22d268
commit
0af34a4197
2 changed files with 12 additions and 1 deletions
|
@ -454,7 +454,7 @@ public class MemoryBlockDB implements MemoryBlock {
|
|||
SubMemoryBlock subBlock = getSubBlock(offset);
|
||||
memMap.lock.acquire();
|
||||
try {
|
||||
subBlock.putByte(offset - subBlock.getStartingOffset(), b);
|
||||
subBlock.putByte(offset, b);
|
||||
}
|
||||
catch (IOException e) {
|
||||
memMap.dbError(e);
|
||||
|
|
|
@ -631,6 +631,17 @@ public class MemBlockDBTest extends AbstractGenericTest {
|
|||
assertEquals(-1, block.getByte(addr(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetBytesInSubBlocks() throws Exception {
|
||||
FileBytes fileBytes = createFileBytes();
|
||||
MemoryBlock block1 = createFileBytesBlock(fileBytes, addr(0), 0, 10);
|
||||
MemoryBlock block2 = createFileBytesBlock(fileBytes, addr(10), 20, 10);
|
||||
mem.join(block1, block2);
|
||||
assertEquals(20, mem.getByte(addr(10)));
|
||||
mem.setByte(addr(10), (byte) 0);
|
||||
assertEquals(0, mem.getByte(addr(10)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBitMappedJoin() throws Exception {
|
||||
FileBytes fileBytes = createFileBytes();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue