1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

6 Commits

Author SHA1 Message Date
Rafael Espindola
fc1039bb12 Add a test of an elf file with an invalid section index.
We were already checking, but were missing a test.

llvm-svn: 241094
2015-06-30 18:23:07 +00:00
Rafael Espindola
ba4f1ed96a Report an error on invalid sh_entsize.
llvm-svn: 241070
2015-06-30 14:59:20 +00:00
Rafael Espindola
50a3948f04 Factor out the checking of string tables.
This moves the error checking for string tables to getStringTable which returns
an ErrorOr<StringRef>.

This improves error checking, makes it uniform across all string tables and
makes it possible to check them once instead of once per name.

llvm-svn: 240950
2015-06-29 14:39:25 +00:00
Rafael Espindola
f9a95b0fa5 Add a testcase for an invalid file.
We were already checking this, but had no tests.

llvm-svn: 240945
2015-06-29 14:12:14 +00:00
Rafael Espindola
d966b65619 Convert an assert that can fail into error checking.
llvm-svn: 240944
2015-06-29 14:02:24 +00:00
Rafael Espindola
e8ff3dd7fa Improve error handling of getRelocationAddend.
This patch changes getRelocationAddend to use ErrorOr and considers it an error
to try to get the addend of a REL section.

If, for example, a x86_64 file has a REL section, that file is corrupted and
we should reject it.

Using ErrorOr is not ideal since we check the section type once per relocation
instead of once per section.

Checking once per section would involve getRelocationAddend just asserting and
callers checking the section before iterating over the relocations.

In any case, this is an improvement and includes a test.

llvm-svn: 240176
2015-06-19 20:58:43 +00:00