r241705 - AST: Avoid reading an unitialized value

Aaron Ballman aaron at aaronballman.com
Wed Jul 8 11:35:59 PDT 2015


Test case?

~Aaron

On Wed, Jul 8, 2015 at 2:32 PM, Justin Bogner <mail at justinbogner.com> wrote:
> Author: bogner
> Date: Wed Jul  8 13:32:26 2015
> New Revision: 241705
>
> URL: http://llvm.org/viewvc/llvm-project?rev=241705&view=rev
> Log:
> AST: Avoid reading an unitialized value
>
> Desugar doesn't necessarily initialize ShouldAKA, but as of r241542 it
> may read it. Fix the misuse of the API and initialize this before
> passing it in.
>
> Found by ubsan.
>
> Modified:
>     cfe/trunk/lib/AST/ASTDiagnostic.cpp
>
> Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=241705&r1=241704&r2=241705&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Wed Jul  8 13:32:26 2015
> @@ -192,8 +192,8 @@ ConvertTypeToDiagnosticString(ASTContext
>      if (CompareCanTy == CanTy)
>        continue;  // Same canonical types
>      std::string CompareS = CompareTy.getAsString(Context.getPrintingPolicy());
> -    bool aka;
> -    QualType CompareDesugar = Desugar(Context, CompareTy, aka);
> +    bool ShouldAKA = false;
> +    QualType CompareDesugar = Desugar(Context, CompareTy, ShouldAKA);
>      std::string CompareDesugarStr =
>          CompareDesugar.getAsString(Context.getPrintingPolicy());
>      if (CompareS != S && CompareDesugarStr != S)
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list