[llvm] [LLVM] [TableGen] Read from uninitialised variable (PR #66889)
Tomáš Zeman via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 03:56:02 PDT 2023
https://github.com/tee-jay-zet created https://github.com/llvm/llvm-project/pull/66889
Fixing an issue found in a UBsan build. When defining a variable-length
encoding with no operands or slices, the HasDynamicSegment member was
read without being initialised.
>From 33f835ec72b3f0f74a6bdf875b2585a1f55acb40 Mon Sep 17 00:00:00 2001
From: Tomas Zeman <tomas.zeman at ericsson.com>
Date: Wed, 20 Sep 2023 12:48:49 +0200
Subject: [PATCH] [LLVM] [TableGen] Read from uninitialised variable
Fixing an issue found in a UBsan build. When defining a variable-length
encoding with no operands or slices, the HasDynamicSegment member was
read without being initialised.
---
llvm/utils/TableGen/VarLenCodeEmitterGen.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp b/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp
index 85da547d04c1336..7a24030e17d8a82 100644
--- a/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp
+++ b/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp
@@ -114,7 +114,7 @@ static std::pair<StringRef, StringRef> getCustomCoders(ArrayRef<Init *> Args) {
}
VarLenInst::VarLenInst(const DagInit *DI, const RecordVal *TheDef)
- : TheDef(TheDef), NumBits(0U) {
+ : TheDef(TheDef), NumBits(0U), HasDynamicSegment(false) {
buildRec(DI);
for (const auto &S : Segments)
NumBits += S.BitWidth;
More information about the llvm-commits
mailing list