summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-05-31 03:57:30 +0000
committerRui Ueyama <ruiu@google.com>2015-05-31 03:57:30 +0000
commitd68ff34ad2c421f5c78e21a4d63832cb8bd8c908 (patch)
treed1902b73d1228aa0ee2c08efbcf70fff6ffb9a58
parent3ee0fe4c2ccb2a2c60d1018d635d3f7fc60868a0 (diff)
downloadbcm5719-llvm-d68ff34ad2c421f5c78e21a4d63832cb8bd8c908.tar.gz
bcm5719-llvm-d68ff34ad2c421f5c78e21a4d63832cb8bd8c908.zip
Fix unsafe memory access.
llvm-svn: 238669
-rw-r--r--lld/COFF/SymbolTable.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index 9a2b03b23e4..f70ba37605f 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -15,6 +15,8 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
+using namespace llvm;
+
namespace lld {
namespace coff {
@@ -172,7 +174,7 @@ ErrorOr<StringRef> SymbolTable::findDefaultEntry() {
{"WinMain", "WinMainCRTStartup"},
{"wWinMain", "wWinMainCRTStartup"},
};
- for (size_t I = 0; I < sizeof(Entries); ++I) {
+ for (size_t I = 0; I < array_lengthof(Entries); ++I) {
if (!find(Entries[I][0]))
continue;
if (auto EC = addSymbol(new Undefined(Entries[I][1])))
OpenPOWER on IntegriCloud