llvm.org GIT mirror llvm / 2bbde38
[Object/ELF] - Do not crash if string table sh_size is equal to zero. Revealed using "id_000038,sig_11,src_000015,op_havoc,rep_16" from PR30540, when sh_size was 0, crash happened. Differential revision: https://reviews.llvm.org/D25091 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285282 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 3 years ago
3 changed file(s) with 3 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
427427 if (std::error_code EC = V.getError())
428428 return EC;
429429 ArrayRef Data = *V;
430 if (Data.empty())
431 return object_error::parse_failed;
430432 if (Data.back() != '\0')
431433 return object_error::string_table_non_null_end;
432434 return StringRef(Data.begin(), Data.size());
0 RUN: not llvm-dwarfdump %p/Inputs/invalid-bad-rel-type.elf 2>&1 | FileCheck %s
11 RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-type.elf 2>&1 | FileCheck %s
22 RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-size.elf 2>&1 | FileCheck %s
3 RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-zero-size.elf 2>&1 | FileCheck %s
34 CHECK: Invalid data was encountered while parsing the file
45
56 RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-non-null.elf 2>&1 | FileCheck --check-prefix=NON-NULL %s