[llvm] r304255 - Fix bug on Big-Endian system, due to reference to vector out of scope.

Eric Beckmann via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 16:10:57 PDT 2017


Author: ecbeckmann
Date: Tue May 30 18:10:57 2017
New Revision: 304255

URL: http://llvm.org/viewvc/llvm-project?rev=304255&view=rev
Log:
Fix bug on Big-Endian system, due to reference to vector out of scope.

Modified:
    llvm/trunk/lib/Object/WindowsResource.cpp

Modified: llvm/trunk/lib/Object/WindowsResource.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WindowsResource.cpp?rev=304255&r1=304254&r2=304255&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WindowsResource.cpp (original)
+++ llvm/trunk/lib/Object/WindowsResource.cpp Tue May 30 18:10:57 2017
@@ -187,8 +187,8 @@ WindowsResourceParser::TreeNode &
 WindowsResourceParser::TreeNode::addChild(ArrayRef<UTF16> NameRef) {
   std::string NameString;
   ArrayRef<UTF16> CorrectedName;
+  std::vector<UTF16> EndianCorrectedName;
   if (llvm::sys::IsBigEndianHost) {
-    std::vector<UTF16> EndianCorrectedName;
     EndianCorrectedName.resize(NameRef.size() + 1);
     std::copy(NameRef.begin(), NameRef.end(), EndianCorrectedName.begin() + 1);
     EndianCorrectedName[0] = UNI_UTF16_BYTE_ORDER_MARK_SWAPPED;




More information about the llvm-commits mailing list