From 5bb06924657332cf35c11840c4a14acb86536fd4 Mon Sep 17 00:00:00 2001 From: "Manna, Soumi" Date: Wed, 31 May 2023 10:11:14 -0700 Subject: [PATCH] [NFC][CLANG] Fix nullptr dereference issue in SetValueDataBasedOnQualType() This patch uses castAs instead of getAs which will assert if the type doesn't match in SetValueDataBasedOnQualType(clang::Value &, unsigned long long). Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D151770 --- clang/lib/Interpreter/Interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 82d4932..4e10452 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -768,7 +768,7 @@ static void SetValueDataBasedOnQualType(Value &V, unsigned long long Data) { if (const auto *ET = QT->getAs()) QT = ET->getDecl()->getIntegerType(); - switch (QT->getAs()->getKind()) { + switch (QT->castAs()->getKind()) { default: llvm_unreachable("unknown type kind!"); #define X(type, name) \ -- 2.7.4