From 26c70bc947487298bfb6a2bc8b05eee2398f1743 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 13 Feb 2014 00:44:34 +0000 Subject: [PATCH] Fix uninitialized read in vtordisp pragma code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201280 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParsePragma.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp index 6d92edb1dfbd..90929d69188e 100644 --- a/lib/Parse/ParsePragma.cpp +++ b/lib/Parse/ParsePragma.cpp @@ -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(static_cast((Kind << 16) | Value))); + AnnotTok.setAnnotationValue(reinterpret_cast( + static_cast((Kind << 16) | (Value & 0xFFFF)))); PP.EnterToken(AnnotTok); }