mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 05:35:02 +08:00
GP-6286 added check for empty array
This commit is contained in:
+13
-9
@@ -2381,19 +2381,23 @@ public class RTTIWindowsClassRecoverer extends RTTIClassRecoverer {
|
|||||||
Map<Integer, Address> classOffsetToVftableMap =
|
Map<Integer, Address> classOffsetToVftableMap =
|
||||||
recoveredClass.getClassOffsetToVftableMap();
|
recoveredClass.getClassOffsetToVftableMap();
|
||||||
Set<Integer> classVftableOffsets = classOffsetToVftableMap.keySet();
|
Set<Integer> classVftableOffsets = classOffsetToVftableMap.keySet();
|
||||||
List<Integer> sortedOffsets = new ArrayList<Integer>(classVftableOffsets);
|
|
||||||
Collections.sort(sortedOffsets);
|
|
||||||
|
|
||||||
Integer offset = sortedOffsets.get(0);
|
if (!classVftableOffsets.isEmpty()) {
|
||||||
|
|
||||||
Address vftableAddress = classOffsetToVftableMap.get(offset);
|
List<Integer> sortedOffsets = new ArrayList<Integer>(classVftableOffsets);
|
||||||
|
Collections.sort(sortedOffsets);
|
||||||
|
|
||||||
DataType classVftablePointer = vfPointerDataTypes.get(vftableAddress);
|
Integer offset = sortedOffsets.get(0);
|
||||||
|
|
||||||
// if it fits at offset or is at the end and class structure can be grown,
|
Address vftableAddress = classOffsetToVftableMap.get(offset);
|
||||||
// copy the whole baseClass structure to the class Structure at the given offset
|
|
||||||
EditStructureUtils.addDataTypeToStructure(classStructureDataType, offset.intValue(),
|
DataType classVftablePointer = vfPointerDataTypes.get(vftableAddress);
|
||||||
classVftablePointer, CLASS_VTABLE_PTR_FIELD_EXT, monitor);
|
|
||||||
|
// if it fits at offset or is at the end and class structure can be grown,
|
||||||
|
// copy the whole baseClass structure to the class Structure at the given offset
|
||||||
|
EditStructureUtils.addDataTypeToStructure(classStructureDataType, offset.intValue(),
|
||||||
|
classVftablePointer, CLASS_VTABLE_PTR_FIELD_EXT, monitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the vbtable structure for single inheritance/virt parent case
|
// add the vbtable structure for single inheritance/virt parent case
|
||||||
|
|||||||
Reference in New Issue
Block a user