Permalink
Browse files

Check byte array size before comparing header in loadArArchive

  • Loading branch information...
sp1187 committed Jul 22, 2018
1 parent 8632b9f commit 725a6bb7508e18e4fd3340ebafb6cbf05048a30d
Showing with 2 additions and 2 deletions.
  1. +2 −2 Core/ELF/ElfRelocator.cpp
@@ -28,9 +28,9 @@ std::vector<ArFileEntry> loadArArchive(const std::wstring& inputName)
ByteArray input = ByteArray::fromFile(inputName);
std::vector<ArFileEntry> result;
if (memcmp(input.data(),"!<arch>\n",8) != 0)
if (input.size() < 8 || memcmp(input.data(),"!<arch>\n",8) != 0)
{
if (memcmp(input.data(),"\x7F""ELF",4) != 0)
if (input.size() < 4 || memcmp(input.data(),"\x7F""ELF",4) != 0)
return result;
ArFileEntry entry;

0 comments on commit 725a6bb

Please sign in to comment.