From 3d01ad116c85af0ba75656d6d7874dd9fda98dec Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Thu, 13 Oct 2016 19:19:37 +0000 Subject: Swift Calling Convention: Fix out of bounds access Use iterator instead of address of element in vector It is not valid to access one after the last element. rdar://28759508 llvm-svn: 284150 --- clang/lib/CodeGen/SwiftCallingConv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/SwiftCallingConv.cpp') diff --git a/clang/lib/CodeGen/SwiftCallingConv.cpp b/clang/lib/CodeGen/SwiftCallingConv.cpp index a79ddf94bc8..1629c443652 100644 --- a/clang/lib/CodeGen/SwiftCallingConv.cpp +++ b/clang/lib/CodeGen/SwiftCallingConv.cpp @@ -384,7 +384,7 @@ void SwiftAggLowering::splitVectorEntry(unsigned index) { auto eltTy = split.first; CharUnits eltSize = getTypeStoreSize(CGM, eltTy); auto numElts = split.second; - Entries.insert(&Entries[index + 1], numElts - 1, StorageEntry()); + Entries.insert(Entries.begin() + index + 1, numElts - 1, StorageEntry()); CharUnits begin = Entries[index].Begin; for (unsigned i = 0; i != numElts; ++i) { -- cgit v1.2.3