Commit 0576474
committed
UnguardedNullReturnDereference: Honor _Analysis_assume_
_Analysis_assume_(Expr) tells the analyzer to treat Expr as true. MSVC
compiles __assume() into an empty statement with no AST node, but the
EmptyStmt remains in the control flow graph at the macro invocation
site. The query was not recognizing this as a null guard:
NBL *Nbl = DequeueNbl(&Queue);
_Analysis_assume_(Nbl);
NET_BUFFER_LIST_STATUS(Nbl) = NDIS_STATUS_FAILURE; // flagged
Match the EmptyStmt at the _Analysis_assume_ location as a barrier by
correlating it with the macro invocation that names the guarded
variable. Also match AssumeExpr directly for compilers that emit it.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>1 parent 6820d66 commit 0576474
1 file changed
Lines changed: 13 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
142 | 155 | | |
143 | 156 | | |
144 | 157 | | |
| |||
0 commit comments