mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[Support/PathV2] Fix out of bounds access in identify_magic when the file is empty.
llvm-svn: 158704
This commit is contained in:
parent
b98d06727e
commit
960b65a03c
@ -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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user