aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Path.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Path.cpp')
-rw-r--r--lib/Support/Path.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp
index 5b34c5e..b6eeb14 100644
--- a/lib/Support/Path.cpp
+++ b/lib/Support/Path.cpp
@@ -58,11 +58,12 @@ sys::identifyFileType(const char *Magic, unsigned Length) {
break;
case '\177':
- if (Magic[1] == 'E' && Magic[2] == 'L' && Magic[3] == 'F') {
+ if (Length >= 18 && Magic[1] == 'E' && Magic[2] == 'L' &&
+ Magic[3] == 'F') {
bool Data2MSB = Magic[5] == 2;
unsigned high = Data2MSB ? 16 : 17;
unsigned low = Data2MSB ? 17 : 16;
- if (Length >= 18 && Magic[high] == 0)
+ if (Magic[high] == 0)
switch (Magic[low]) {
default: break;
case 1: return ELF_Relocatable_FileType;