]> granicus.if.org Git - clang/commitdiff
Fix uninitialized read in vtordisp pragma code.
authorReid Kleckner <reid@kleckner.net>
Thu, 13 Feb 2014 00:44:34 +0000 (00:44 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 13 Feb 2014 00:44:34 +0000 (00:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201280 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParsePragma.cpp

index 6d92edb1dfbd09ff13d9ac34ce8785f8cae49bf4..90929d69188eb321d002a874612e5b73085188d7 100644 (file)
@@ -958,7 +958,7 @@ void PragmaMSVtorDisp::HandlePragma(Preprocessor &PP,
   }
 
 
-  uint64_t Value;
+  uint64_t Value = 0;
   if (Kind == Sema::PVDK_Push || Kind == Sema::PVDK_Set) {
     const IdentifierInfo *II = Tok.getIdentifierInfo();
     if (II && II->isStr("off")) {
@@ -998,8 +998,8 @@ void PragmaMSVtorDisp::HandlePragma(Preprocessor &PP,
   AnnotTok.startToken();
   AnnotTok.setKind(tok::annot_pragma_ms_vtordisp);
   AnnotTok.setLocation(VtorDispLoc);
-  AnnotTok.setAnnotationValue(
-      reinterpret_cast<void *>(static_cast<uintptr_t>((Kind << 16) | Value)));
+  AnnotTok.setAnnotationValue(reinterpret_cast<void *>(
+      static_cast<uintptr_t>((Kind << 16) | (Value & 0xFFFF))));
   PP.EnterToken(AnnotTok);
 }