Commit Graph

385 Commits

Author SHA1 Message Date
chrchr-github 2bccde0e3b
Fix #9789 FP Logical condition considered always false (#3985) 2022-04-09 14:09:10 +02:00
chrchr-github 52b4aeb279
Fix #10792 FP knownConditionTrueFalse with double to int cast (#3964) 2022-04-07 10:42:57 +02:00
Paul Fultz II 74667d1e2a
Fix 10418: false negative: knownConditionTrueFalse (#3981)
* Improve handling inverted condition

* Fix tests

* Rename variables for clarity

* Add initial test

* Add another test

* Format

* Fix FP
2022-04-07 06:48:13 +02:00
Paul Fultz II 4fde7f8b18
Fix 10449: Regression: knownConditionTrueFalse (strlen/wcslen) (#3977)
* Refactor library function usage

* Evaluate library function in program memory

* Fix and add tests

* Format
2022-04-06 06:35:38 +02:00
Paul Fultz II 0547cbcd26
Fix 10647: FN knownConditionTrueFalse for impossible Boolean value (#3968)
* Add impossible values for bool

* Fix valueflow tests

* Fix assertion failure

* Add test

* Format
2022-04-03 20:04:05 +02:00
chrchr-github 3faff5e9fc
Fix #10248 FP knownConditionTrueFalse static variable with direct initialization (#3922) 2022-03-22 07:24:40 +01:00
Paul Fultz II ff902369e0
Fix 10851: False positive: known variable value below for loop (#3891)
* Fix 10851: False positive: known variable value below for loop

* Format

* Add test for 10863

* Format
2022-03-12 06:15:35 +01:00
Paul Fultz II 0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified (#3857)
* Fix 10702: FP knownConditionTrueFalse - Member variable modified

* Format

* Make parameter const

* Fix FP

* Fix FP

* Update

* Format
2022-02-28 18:54:55 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly (#3767) 2022-02-10 23:02:24 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
chrchr-github a20465eaea
Fix #10484 FP knownConditionTrueFalse with static variable and direct initialization / partial fix for #10248 (#3728) 2022-02-02 22:30:49 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
chrchr-github 7f9ef8c321
Add test cases for #7899, #7974, #9256 (#3726)
* Add test case for #7899 and #7974

* Add test case for ##9256
2022-01-20 16:15:38 +01:00
Paul Fultz II 71a44395c8
Fix 10659: FP knownConditionTrueFalse - C++17 structured binding (#3662) 2022-01-02 08:14:50 +01:00
Paul Fultz II 0c952ca05d
Fix 10223: ValueFlow; known value for a volatile variable (#3658) 2022-01-01 23:15:14 +01:00
Paul Fultz II 73f24b43f9
Fix 10437: FP knownConditionTrueFalse after pointer check (#3646) 2021-12-20 07:28:40 +01:00
chrchr-github 8df25ec4e9
Fix #8266 identicalConditionAfterEarlyExit variable modified in if-clause (#3610) 2021-12-18 22:52:54 +01:00
Paul Fultz II 5414814238
Fix 10649: False positive: wrong known value after reassignment (#3631) 2021-12-15 19:37:25 +01:00
Paul Fultz II 5f73af0d0e
Fix 10625: False positive: known value below do while (#3623) 2021-12-15 19:32:14 +01:00
chrchr-github 532477cdb2
Fix #9549 FP knownConditionTrueFalse (bitshift) (#3616) 2021-12-14 07:30:57 +01:00
Paul Fultz II c14920218c
Fix 10624: FP knownConditionTrueFalse with pointer member and dynamic cast (#3598) 2021-12-04 08:54:24 +01:00
chrchr-github ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code (#3501) 2021-11-29 07:34:39 +01:00
Daniel Marjamäki f701a9361d chmod; Use 644 for source files 2021-11-17 08:25:25 +01:00
Paul Fultz II 13f5b560ce
Fix 10555: FP knownConditionTrueFalse with non-const function in base class (#3559) 2021-11-12 20:05:43 +01:00
Paul Fultz II a50596df72
Fix 10582: ValueFlow; wrong known value (#3550) 2021-11-07 06:51:51 +01:00
Paul Fultz II df59b07ba1
Fix 10226: FN: knownConditionTrueFalse (#3537) 2021-10-31 14:51:07 +01:00
Paul Fultz II 7f04658585
Fix 10548: FP knownConditionTrueFalse with loop and operator++ (#3511) 2021-10-15 10:59:01 +02:00
Paul Fultz II f1f86db0da
Fix 10544: FP knownConditionTrueFalse with loop after check (#3508) 2021-10-14 16:47:15 +02:00
orbitcowboy f09b4139fe Ticket #8407: Added regression test 2021-10-12 09:42:18 +02:00
orbitcowboy c3af708a55 Ticket #8209: Added regression test 2021-10-12 08:25:08 +02:00
Paul Fultz II 5e9bc48d26
Evaluate symbolic values (#3495) 2021-10-11 19:10:37 +02:00
Daniel Marjamäki 6bd5f79451 Revert "Fix 8629: false negative: (style) Condition '...' is always true (#3492)"
This reverts commit b9be38aaec.
2021-10-10 21:21:21 +02:00
Paul Fultz II b9be38aaec
Fix 8629: false negative: (style) Condition '...' is always true (#3492) 2021-10-09 16:20:38 +02:00
Paul Fultz II bc90ae889d
Fix 10543: FP knownConditionTrueFalse with static variable (#3491) 2021-10-09 16:20:04 +02:00
Paul Fultz II a1e0ef9b38
Refactor: Use interval analysis for symbolic values for inferCondtion (#3488) 2021-10-09 16:19:06 +02:00
Paul Fultz II 3cb252bd99
Fix 9873: False negative: null pointer when checking raw pointer (#3485) 2021-10-06 08:39:58 +02:00
Daniel Marjamäki b455f847ba Fixed #10448 (FN compareValueOutOfTypeRangeError with int32_t) 2021-09-12 15:08:14 +02:00
Paul Fultz II 8a708e556c
Fix 10456: FP identicalConditionAfterEarlyExit with variable captured by reference (#3439) 2021-09-04 19:05:41 +02:00
Paul Fultz II b788e41191
Fix 10438: FP knownConditionTrueFalse after return in a catch clause (#3429) 2021-09-03 23:07:08 +02:00
Daniel Marjamäki 19fea629c6 Fix FP in checkCompareValueOutOfTypeRange when sign is unknown 2021-08-29 16:03:56 +02:00
Paul Fultz II 4566e0e439
Fix 10148: False positive: knownConditionTrueFalse in for loop due to &= (#3425) 2021-08-28 09:28:29 +02:00
Paul Fultz II 740becbddf
Fix 10348: FP knownConditionTrueFalse with condition variable in do ... while loop (#3422) 2021-08-27 05:46:57 +02:00
orbitcowboy b0407ea6b4 Added comment to ticket number, there are no real changes [ci skip] 2021-08-25 21:14:19 +02:00
orbitcowboy 7d14f461f0 #8860: Added regression test 2021-08-24 14:36:13 +02:00
Paul Fultz II a0c37ceba2
Fix FP: Set correct bounds for interval (#3411) 2021-08-21 21:17:05 +02:00
Paul Fultz II e62cdbb664
Deduce symbolic values from conditions (#3406) 2021-08-19 22:01:55 +02:00
Paul Fultz II e0de48bb1d
Fix 7524: ValueFlow: false path for 'x<3' (#3393) 2021-08-16 09:19:07 +02:00
Paul Fultz II b9ac48c90a
Fix 10409: FP 'Condition 's.size()<3' is always false' (#3396) 2021-08-14 06:48:38 +02:00
Daniel Marjamäki d0b6079a83 Fixed #10372 (Confusing message for compareValueOutOfTypeRangeError) 2021-08-10 09:38:28 +02:00
Paul Fultz II a218ea3b23
Fix 10404: FP knownConditionTrueFalse after subtraction (#3390) 2021-08-09 07:45:41 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
orbitcowboy 1f411498b6 #8196: Added a regression test 2021-08-05 08:07:03 +02:00
Paul Fultz II 8b8ae55490
Fix 10129: false negative: knownConditionTrueFalse (#3382)
* Add symbolic matching

* Check for truncated values

* Dont propagate uninit values

* Update errorpath test

* Add test case for 10129

* Add test case for FP

* Remove symbolic values that are the same as the token

* Fix test messages

* Fix cppcheck issue

* Format
2021-08-04 21:07:31 +02:00
Paul Fultz II 7be9b217e6
Fix 7843 and 7844: ValueFlow for abs (#3373)
* Refactor: Use valueFlowForward to forward values in condition expression

* Formattting

* Make known when using bools as well

* Set abs function as always positive

* Add test

* Add valueFlowSymbolicAbs

* Set impossible values

* Fix test case

* Fix error messages

* Merge
2021-08-03 06:31:28 +02:00
Paul Fultz II 3d19b33c3e
Fix 9948 and 10234: false negative: knownConditionTrueFalse and stlOutOfBounds (#3372) 2021-08-02 10:51:34 +02:00
chrchr-github 405e17985a
Add test case for ticket #9808 (#3366) 2021-08-02 06:53:54 +02:00
orbitcowboy ccd525962b #8220: Added a regression test. 2021-08-01 12:32:01 +02:00
Paul Fultz II 7d9fdf582b
Fix 10121: False positive: Condition 'ab->a!=123' is always false when modifying an alias (#3293) 2021-08-01 10:10:11 +02:00
chrchr-github 9d51b4450b
Add test cases for tickets #9976 and #10371 (#3364) 2021-07-27 22:26:19 +02:00
Paul Fultz II 14802b932e
Fix 10362: ValueFlow: global variable might be modified by function call (#3358) 2021-07-26 22:21:56 +02:00
Daniel Marjamäki 797de4ef92 Fixed #10363 (FP: compareValueOutOfTypeRangeError) 2021-07-16 19:08:08 +02:00
Daniel Marjamäki cbb07b6247 misra; implement rule 14.3 2021-07-15 09:43:38 +02:00
Paul Fultz II 66956ed959
Fix 10323: Wrong known value. x!=0 does not mean that x==1 (#3308) 2021-06-26 09:16:45 +02:00
Paul Fultz II 508188df2b
Fix 10297: Regression; ValueFlow known value, sign conversion (#3307) 2021-06-26 09:16:04 +02:00
Daniel Marjamäki 9769afe434 knownConditionTrueFalse; avoid several warnings when nonzero expression is compared to see if it is positive or negative 2021-06-25 16:25:25 +02:00
Paul Fultz II 486e440c4a
Fix 10298: ValueFlow: Wrong known value, 'x == -1' implicit unsigned cast for rhs (#3277) 2021-06-04 17:17:41 +02:00
Paul Fultz II 4b11bb4ad3
10278: ValueFlow: Wrong known value, sign conversion (#3260) 2021-05-18 07:28:45 +02:00
Daniel Marjamäki 08184f4681 Fixed #10070 (FP warning: Logical disjunction always evaluates to true) 2021-05-04 13:47:09 +02:00
Paul Fultz II 691f681d86
Fix issue 10235: Regression: oppositeInnerCondition (#3223) 2021-04-19 09:15:03 +02:00
Paul Fultz II 563c9dd9cc
Fix issue 10208: FP: knownConditionTrueFalse in for loop with function that assigns by ref (#3198) 2021-04-18 21:42:27 +02:00
orbitcowboy f7e6d216b2 Running astyle [ci skip] 2021-04-09 08:53:32 +02:00
orbitcowboy b5719418ea #8206 - Added a regression test 2021-04-09 08:53:01 +02:00
Daniel Marjamäki c8e661f61f assignmentInCondition: Clarify error message 2021-04-07 19:46:00 +02:00
Daniel Marjamäki 72802554c9 Fixed #3593 (New Check: Check for assignment within conditional expression) 2021-04-07 17:21:34 +02:00
Paul Fultz II 5077663684
Fix issue 9979: false positive: containerOutOfBounds with conditional resize (#3136) 2021-03-30 14:02:28 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00
PKEuS cf1937294a Refactorization: Removed unnecessary \n and spaces in strings
Merged from LCppC.
2021-02-20 12:58:42 +01:00
Daniel Marjamäki 49e6e83bc3 astyle formatting
[ci skip]
2021-01-29 10:27:32 +01:00
Paul Fultz II a81427f97f
Fix issue 10022: Logical conjunction error between two completely unrelated members (#3094) 2021-01-29 10:26:57 +01:00
Paul Fultz II e17d22eb87
Fix issue 10134: False positive: value is not known. Early return. (#3086) 2021-01-28 12:37:56 +01:00
Paul Fultz II d80f2fb46f
Reapply f1cc3ad and fix performance regression (#3076) 2021-01-23 08:47:39 +01:00
Daniel Marjamäki 0fa89ff2ba Revert 14365ffc7 and f1cc3ada8, there was a performance regression 2021-01-22 10:51:46 +01:00
Paul Fultz II f1cc3ada86
Refactor valueFlowTerminatingCondition to handle inner conditions and complex conditions (#3060) 2021-01-21 20:18:53 +01:00
Daniel Marjamäki 76f759fcc4 Fixed #9702 (False positive: Opposite inner condition when modifying member variable used by inner condition) 2021-01-15 20:51:47 +01:00
Paul Fultz II f0b5668436
Fix issue 9890: ValueFlow: known value not found (variable is changed in path that returns) (#3010) 2021-01-05 16:49:08 +01:00
Daniel Marjamäki b3b7ecc7ea Removed integerOverflowOptimization checking and merged functionality into invalidTestForOverflow 2021-01-05 11:38:19 +01:00
Paul Fultz II 626dcd0eba
Fix issue 10037: False positive when passing variables to functions by address (#2957) 2020-12-19 08:29:37 +01:00
Rikard Falkeborn 829c543331
TestCondition: Don't warn when sizeof is involved (#2896) 2020-11-11 08:01:11 +01:00
Paul Fultz II bd7e915c20
Add generic reverse valueflow (#2878) 2020-11-10 16:00:55 +01:00
Daniel Marjamäki 47914b9960 Crash: Add regression test 2020-10-22 07:40:06 +02:00
Ken-Patrick Lehrmann e4a54a24db
Fix regression in CheckCondition (#2854)
Introduced by e2a81a382f.
2020-10-20 07:56:41 +02:00
Paul Fultz II 857722f859
Fix issue 9711: FP knownConditionTrueFalse for variable modified via pointer (#2813) 2020-09-20 14:27:09 +02:00
Paul Fultz II c2e8051196
Fix issue 9904: False positive: duplicateCondition when modifying variable in lambda (#2811) 2020-09-18 07:44:26 +02:00
Paul Fultz II bfe53fce04
Fix issue 9878: false positive: multiCondition (#2787) 2020-09-09 15:39:36 +02:00
Paul Fultz II a4f43fc2ad
Fix issue 8234: false negative: (warning) Opposite inner 'if' condition leads to a dead code block. (#2781) 2020-09-07 07:53:41 +02:00
Daniel Marjamäki 040da4ff32 astyle formatting 2020-09-04 18:43:17 +02:00
shaneasd 84dd0c961f
False positive dynamic_cast auto variable which has been checked against null (#2769) 2020-09-04 07:06:26 +02:00
shaneasd 08ea6435ac
fix false positives in constParameter (#2758) 2020-09-03 18:44:44 +02:00
Paul Fultz II ba84196dca
Fix issue 9865: false positive: knownConditionTrueFalse (#2764) 2020-09-01 11:22:38 +02:00