From 71f3c1921a8c56123d74f65e62b0c736297ad0fa Mon Sep 17 00:00:00 2001 From: George Rimar Date: Mon, 17 Oct 2016 09:30:06 +0000 Subject: [Object/ELF] - Do not crash on invalid section index. If object has wrong (large) string table index and also incorrect large value for amount of sections in total, then section index passes the check: if (Index >= getNumSections()) return object_error::invalid_section_index; But result pointer then is far after end of file data, what result in a crash. Differential revision: https://reviews.llvm.org/D25081 llvm-svn: 284369 --- llvm/test/Object/invalid.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/test/Object/invalid.test') diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test index 9f5587422d1..d940789b6dc 100644 --- a/llvm/test/Object/invalid.test +++ b/llvm/test/Object/invalid.test @@ -41,7 +41,7 @@ RUN: not llvm-readobj --dyn-symbols %p/Inputs/invalid-sh_entsize.elf 2>&1 | File INVALID-DYNSYM-SIZE: Invalid entity size RUN: not llvm-readobj -t %p/Inputs/invalid-section-index.elf 2>&1 | FileCheck --check-prefix=INVALID-SECTION-INDEX %s - +RUN: not llvm-readobj -t %p/Inputs/invalid-section-index2.elf 2>&1 | FileCheck --check-prefix=INVALID-SECTION-INDEX %s INVALID-SECTION-INDEX: Invalid section index RUN: not llvm-readobj -s %p/Inputs/invalid-section-size.elf 2>&1 | FileCheck --check-prefix=INVALID-SECTION-SIZE %s -- cgit v1.2.3