================
@@ -101,9 +101,17 @@ class SymbolConjured : public SymbolData {
 
   // It might return null.
   const Stmt *getStmt() const {
+    if (const auto *Parent = Elem.getParent()) {
+      // Sometimes the CFG element is invalid, avoid dereferencing it.
+      if (Elem.getIndexInBlock() >= Parent->size())
+        return nullptr;
----------------
fangyi-zhou wrote:

I'm getting a bit confused here. The issue at hand is that we have a valid 
`blockPtr` and an invalid index (`ptr` points to the correct CFG block, but the 
block has no elements, and the index is set to the default value of 0). Are you 
suggesting that we should check both the pointer and the index?

https://github.com/llvm/llvm-project/pull/139980
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to