mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-02-16 15:40:14 +00:00
Fix #327 by taking the longer of sizeOfRawData or virtualSize.
This fixes all issues of #327.
This commit is contained in:
parent
49c2010b63
commit
69f8247194
@ -313,7 +313,11 @@ public class FileHeader implements StructConverter {
|
||||
int sizeOfRawData = sectionHeaders[i].getSizeOfRawData();
|
||||
sizeOfRawData = PortableExecutable.computeAlignment(sizeOfRawData, optHeader.getFileAlignment());
|
||||
sectionHeaders[i].setSizeOfRawData(sizeOfRawData);
|
||||
|
||||
|
||||
int virtualSize = sectionHeaders[i].getVirtualSize();
|
||||
virtualSize = PortableExecutable.computeAlignment(virtualSize, optHeader.getSectionAlignment());
|
||||
sectionHeaders[i].setVirtualSize(virtualSize);
|
||||
|
||||
tmpIndex += SectionHeader.IMAGE_SIZEOF_SECTION_HEADER;
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class PortableExecutable {
|
||||
}
|
||||
|
||||
public static int computeAlignment(int value, int alignment) {
|
||||
if ((value % alignment) == 0) {
|
||||
if ( alignment == 0 || (value % alignment) == 0) {
|
||||
return value;
|
||||
}
|
||||
int a = ((value + alignment) / alignment) * alignment;
|
||||
|
Loading…
Reference in New Issue
Block a user