[PATCH] D102280: [analyzer] Engine: fix crash with SEH __leave keyword
Abbas Sabra via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 11 14:48:28 PDT 2021
AbbasSabra created this revision.
Herald added subscribers: steakhal, ASDenysPetrov, martong, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
AbbasSabra requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102280
Files:
clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
clang/test/Analysis/misc-ms-leave.cpp
Index: clang/test/Analysis/misc-ms-leave.cpp
===================================================================
--- /dev/null
+++ clang/test/Analysis/misc-ms-leave.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions -verify %s
+
+void test() {
+ int *p = 0;
+ int x = *p; // expected-warning {{Dereference of null pointer (loaded from variable 'p')}}
+}
+
+int filter();
+
+void try_except_leave() {
+ __try {
+ __leave;
+ } __except (filter()) {
+ }
+ int *p = 0;
+ int x = *p; // expected-warning {{Dereference of null pointer (loaded from variable 'p')}}
+}
Index: clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -349,6 +349,7 @@
HandleBranch(cast<ForStmt>(Term)->getCond(), Term, B, Pred);
return;
+ case Stmt::SEHLeaveStmtClass:
case Stmt::ContinueStmtClass:
case Stmt::BreakStmtClass:
case Stmt::GotoStmtClass:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102280.344568.patch
Type: text/x-patch
Size: 1114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210511/55ebc33d/attachment-0001.bin>
More information about the cfe-commits
mailing list