* binary.cc (Binary_to_elf::sized_convert): Don't crash if the
binary input file is empty.
This commit is contained in:
parent
b3c88224d5
commit
69d53f7ae0
2 changed files with 17 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2011-05-29 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
|
* binary.cc (Binary_to_elf::sized_convert): Don't crash if the
|
||||||
|
binary input file is empty.
|
||||||
|
|
||||||
2011-05-27 Ian Lance Taylor <iant@google.com>
|
2011-05-27 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
* testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
|
* testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
|
||||||
|
|
|
@ -132,7 +132,11 @@ Binary_to_elf::sized_convert(const Task* task)
|
||||||
}
|
}
|
||||||
|
|
||||||
section_size_type filesize = convert_to_section_size_type(f.filesize());
|
section_size_type filesize = convert_to_section_size_type(f.filesize());
|
||||||
const unsigned char* fileview = f.get_view(0, 0, filesize, false, false);
|
const unsigned char* fileview;
|
||||||
|
if (filesize == 0)
|
||||||
|
fileview = NULL;
|
||||||
|
else
|
||||||
|
fileview = f.get_view(0, 0, filesize, false, false);
|
||||||
|
|
||||||
unsigned int align;
|
unsigned int align;
|
||||||
if (size == 32)
|
if (size == 32)
|
||||||
|
@ -223,10 +227,13 @@ Binary_to_elf::sized_convert(const Task* task)
|
||||||
shstrtab.get_strtab_size(),
|
shstrtab.get_strtab_size(),
|
||||||
0, 0, 1, 0, &pout);
|
0, 0, 1, 0, &pout);
|
||||||
|
|
||||||
memcpy(pout, fileview, filesize);
|
if (filesize > 0)
|
||||||
pout += filesize;
|
{
|
||||||
memset(pout, 0, aligned_filesize - filesize);
|
memcpy(pout, fileview, filesize);
|
||||||
pout += aligned_filesize - filesize;
|
pout += filesize;
|
||||||
|
memset(pout, 0, aligned_filesize - filesize);
|
||||||
|
pout += aligned_filesize - filesize;
|
||||||
|
}
|
||||||
|
|
||||||
this->write_symbol<size, big_endian>("", &strtab, 0, 0, &pout);
|
this->write_symbol<size, big_endian>("", &strtab, 0, 0, &pout);
|
||||||
this->write_symbol<size, big_endian>(start_symbol_name, &strtab, 0, 1,
|
this->write_symbol<size, big_endian>(start_symbol_name, &strtab, 0, 1,
|
||||||
|
|
Loading…
Reference in a new issue