[llvm] c599cb5 - [Verifier] Check valid raw_ostream pointer before printing errors
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 02:22:24 PDT 2023
Author: Sameer Sahasrabuddhe
Date: 2023-08-01T14:51:53+05:30
New Revision: c599cb5d0a162be4c558f2142e635e8c1ce04ebe
URL: https://github.com/llvm/llvm-project/commit/c599cb5d0a162be4c558f2142e635e8c1ce04ebe
DIFF: https://github.com/llvm/llvm-project/commit/c599cb5d0a162be4c558f2142e635e8c1ce04ebe.diff
LOG: [Verifier] Check valid raw_ostream pointer before printing errors
The GenericConvergenceVerifier stores a pointer *OS, which can be nullptr. This
can crash the verifier.
Added:
Modified:
llvm/include/llvm/ADT/GenericConvergenceVerifierImpl.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/GenericConvergenceVerifierImpl.h b/llvm/include/llvm/ADT/GenericConvergenceVerifierImpl.h
index 5a50ddf256ca69..b049f80091a212 100644
--- a/llvm/include/llvm/ADT/GenericConvergenceVerifierImpl.h
+++ b/llvm/include/llvm/ADT/GenericConvergenceVerifierImpl.h
@@ -93,8 +93,9 @@ template <class ContextT>
void GenericConvergenceVerifier<ContextT>::reportFailure(
const Twine &Message, ArrayRef<Printable> DumpedValues) {
FailureCB(Message);
- for (auto V : DumpedValues) {
- *OS << V << '\n';
+ if (OS) {
+ for (auto V : DumpedValues)
+ *OS << V << '\n';
}
}
More information about the llvm-commits
mailing list