[ELF] - Do not crash on invalid size of dynamic section.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 7 Oct 2016 09:01:04 +0000 (09:01 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 7 Oct 2016 09:01:04 +0000 (09:01 +0000)
commit53cf2a81128c4bbeb480d80cbcf409d7b207239d
treefaf54fa54cae1f52ccb4969df5a2f0eb194dba58
parentb7aec331255e7be93652dfad94e817fd8b7be0b8
[ELF] - Do not crash on invalid size of dynamic section.

Previously if sh_size of dynamic section was broken,
lld may crash. Or even may not crash if used 32 bits host.
(then value may be truncated to 32 bits when doing pointer arithmetic
and could be just zero).
Patch fixes the issue.

Differential revision: https://reviews.llvm.org/D25327

llvm-svn: 283533
lld/ELF/InputFiles.cpp
lld/test/ELF/invalid/Inputs/dynamic-section-sh_size.elf [new file with mode: 0644]
lld/test/ELF/invalid/dynamic-section-size.s [new file with mode: 0644]