mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-2620 Don't pack sized structs that don't have components
This commit is contained in:
@@ -16,12 +16,14 @@
|
||||
package ghidra.app.util.bin.format.dwarf4.next;
|
||||
|
||||
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFAttribute.*;
|
||||
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.*;
|
||||
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.DW_TAG_base_type;
|
||||
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.DW_TAG_subrange_type;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ghidra.app.util.DataTypeNamingUtil;
|
||||
@@ -748,8 +750,11 @@ public class DWARFDataTypeImporter {
|
||||
|
||||
private void packCompositeIfPossible(DWARFDataType ddt) {
|
||||
Composite original = (Composite) ddt.dataType;
|
||||
if (original.isZeroLength()) {
|
||||
return; // don't try to pack empty structs, this would throw off conflicthandler logic
|
||||
if (original.isZeroLength() || original.getNumComponents() == 0) {
|
||||
// don't try to pack empty structs, this would throw off conflicthandler logic.
|
||||
// also don't pack sized structs with no fields because when packed down to 0 bytes they
|
||||
// cause errors when used as a param type
|
||||
return;
|
||||
}
|
||||
|
||||
Composite copy = (Composite) original.copy(dataTypeManager);
|
||||
|
||||
Reference in New Issue
Block a user