archive-file: Work-around when strtab.data() returns NULL #269
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Under certain environment, strtab.data() could return NULL, and link would
fail. See the ASAN output below.
AddressSanitizer:DEADLYSIGNAL
==1022==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7ffff6e9455d bp 0x000000000000 sp 0x7fffffff9aa8 T0)
==1022==The signal is caused by a READ memory access.
==1022==Hint: address points to the zero page.
#0 0x7ffff6e9455d in __strstr_sse2_unaligned (/lib/libc.so.6+0xb755d)
#1 0x7ffff7659b20 in __interceptor_strstr ../../../../gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:595
#2 0x7ffff7659b20 in __interceptor_strstr ../../../../gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:590
#3 0x555555b7d28c in std::vector<mold::MappedFile<mold::elf::Contextmold::elf::X86_64 >, std::allocator<mold::MappedFile<mold::elf::Contextmold::elf::X86_64 >> > mold::read_fat_archive_members<mold::elf::Contextmold::elf::X86_64 >(mold::elf::Contextmold::elf::X86_64&, mold::MappedFile<mold::elf::Contextmold::elf::X86_64 >*) elf/../archive-file.h:99
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/libc.so.6+0xb755d) in __strstr_sse2_unaligned
==1022==ABORTING
Signed-off-by: Hiroshi Takekawa sian.ht@gmail.com