fixed bug in memory block split

This commit is contained in:
ghidravore 2019-07-30 14:05:48 -04:00
parent 7f2dde2c27
commit c67b9e44bb
2 changed files with 11 additions and 0 deletions

View File

@ -216,6 +216,7 @@ abstract class SubMemoryBlock {
* @throws IOException if a database error occurs.
*/
protected void setParentIdAndStartingOffset(long key, long startingOffset) throws IOException {
this.startingOffset = startingOffset;
record.setLongValue(MemoryMapDBAdapter.SUB_PARENT_ID_COL, key);
record.setLongValue(MemoryMapDBAdapter.SUB_START_OFFSET_COL, startingOffset);
adapter.updateSubBlockRecord(record);

View File

@ -406,6 +406,16 @@ public class MemBlockDBTest extends AbstractGenericTest {
assertEquals(10, sourceInfo.getLength());
}
@Test
public void testSplitAfterExpand() throws Exception {
FileBytes fileBytes = createFileBytes();
MemoryBlock block1 = createFileBytesBlock(fileBytes, addr(0), 0, 50);
MemoryBlock block2 = mem.createBlock(block1, block1.getName() + ".exp", addr(50), 50);
MemoryBlock expandedBlock = mem.join(block1, block2);
mem.split(expandedBlock, addr(50));
assertEquals(0, mem.getByte(addr(50)));
}
@Test
public void testSplitFileBytes() throws Exception {
FileBytes fileBytes = createFileBytes();