Commit 0d63553
committed
Fix #14369: Move boolean literal evaluation to valueFlowSetConstantValue
Previously, boolean literals were processed in a separate loop after
valueFlowSetConstantValue. This triggered nullPointer FP with code such as:
int f() {
const int* p = true ? new int() : nullptr;
return *p; // nullPointer FP
}
Because the condition token had no known value, both branches of the ternary
operator were treated as possible, leaking a spurious null value.
Signed-off-by: Francois Berder <fberder@outlook.fr>1 parent f4be614 commit 0d63553
3 files changed
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 433 | + | |
439 | 434 | | |
440 | 435 | | |
441 | 436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1210 | 1220 | | |
1211 | 1221 | | |
1212 | 1222 | | |
| |||
0 commit comments