OSDN Git Service
(root)
/
android-x86
/
external-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bde801b
)
[Support/PathV2] Fix out of bounds access in identify_magic when the file is empty.
author
Michael J. Spencer
<bigcheesegs@gmail.com>
Tue, 19 Jun 2012 05:29:57 +0000
(
05:29
+0000)
committer
Michael J. Spencer
<bigcheesegs@gmail.com>
Tue, 19 Jun 2012 05:29:57 +0000
(
05:29
+0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158704
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Support/PathV2.cpp
patch
|
blob
|
history
diff --git
a/lib/Support/PathV2.cpp
b/lib/Support/PathV2.cpp
index
e2a69a6
..
46571c0
100644
(file)
--- a/
lib/Support/PathV2.cpp
+++ b/
lib/Support/PathV2.cpp
@@
-744,6
+744,8
@@
error_code has_magic(const Twine &path, const Twine &magic, bool &result) {
/// @brief Identify the magic in magic.
file_magic identify_magic(StringRef magic) {
+ if (magic.size() < 4)
+ return file_magic::unknown;
switch ((unsigned char)magic[0]) {
case 0xDE: // 0x0B17C0DE = BC wraper
if (magic[1] == (char)0xC0 && magic[2] == (char)0x17 &&