C++: Add FP test.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-01-29 16:16:16 +00:00
parent aeae208dc3
commit 7e29141196
2 changed files with 15 additions and 0 deletions

View File

@@ -3,3 +3,4 @@
| test.cpp:204:7:204:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
| test.cpp:436:7:436:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
| test.cpp:443:11:443:15 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
| test.cpp:467:8:467:12 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |

View File

@@ -458,4 +458,18 @@ void disjunct_boolean_condition(const char* modifier_data) {
return;
}
use(value); // GOOD
}
void check_for_negative_test() {
int res;
int value;
res = scanf("%d", &value); // GOOD [FALSE POSITIVE]
if(res == 0) {
return;
}
if (res < 0) {
return;
}
use(value);
}