[OBJ2BIN]

Fix handling of empty sections

svn path=/trunk/; revision=52363
This commit is contained in:
Timo Kreuzer 2011-06-19 11:53:10 +00:00
parent 61c822816d
commit 80aa713b95

View file

@ -63,14 +63,12 @@ int main(int argc, char *argv[])
{
char *pszSourceFile;
char *pszDestFile;
unsigned long nFileSize, nBaseAddress, nOffsetSectionHeaders;
unsigned long nFileSize, nBaseAddress;
FILE *pSourceFile, *pDestFile;
IMAGE_FILE_HEADER *pFileHeader;
IMAGE_SECTION_HEADER *pSectionHeader;
unsigned int i;
size_t nSize;
char *pData;
PIMAGE_RELOCATION pReloc;
PIMAGE_SYMBOL pSymbols;
if ((argc != 4) || (strcmp(argv[1], "--help") == 0))
@ -129,11 +127,9 @@ int main(int argc, char *argv[])
/* Loop all sections */
for (i = 0; i < pFileHeader->NumberOfSections; i++)
{
/* Skip empty sections */
if (pSectionHeader->SizeOfRawData == 0) continue;
/* Check if this is '.text' section */
if (strcmp(pSectionHeader->Name, ".text") == 0)
if ((strcmp(pSectionHeader->Name, ".text") == 0) &&
(pSectionHeader->SizeOfRawData != 0))
{
RelocateSection(pData,
pSectionHeader,