Commit Graph

32 Commits

Author SHA1 Message Date
Paul Fultz II ad8abdb0c3 Add impossible values to ValueFlow (#2186)
* Add impossible category

* Replace values

* Try to adjust known values

* Add ! for impossible values

* Add impossible with possible values

* Remove contradictions

* Add values when the branch is not dead

* Only copy possible values

* Dont bail on while loops

* Load std lib in valueflow

* Check for function calls

* Fix stl errors

* Fix incorrect impossible check

* Fix heap-after-use error

* Remove impossible values when they are lowered

* Show the bound and remove overlaps

* Infer conditions

* Dont push pointer values through dynamic_cast

* Add test for dynamic_cast issue

* Add shifttoomanybits test

* Add test for div by zero

* Add a test for issue 9315

* Dont make impossible value inconclusive

* Fix FP with shift operator

* Improve handleKnownValuesInLoop for impossible values

* Fix cppcheck warning

* Fix impossible values for ctu

* Bailout for streams

* Check equality conditions

* Fix overflows

* Add regression test for 9332

* Remove duplicate conditions

* Skip impossible values for invalid value

* Check for null

* Rename bound to range

* Formatting
2019-09-20 15:06:37 +02:00
Daniel Marjamäki fc25fe83bd ctu: fixed error locations 2019-09-12 19:20:13 +02:00
Daniel Marjamäki b8e3d3b982 CTU: Add 'column' 2019-09-12 10:46:33 +02:00
Daniel Marjamäki 2d9a131817 Refactoring: Rename variables. Do not use leading _. Renamed 'col' to 'column' 2019-08-18 12:19:05 +02:00
Daniel Marjamäki 0014fe880e Mark members and arguments with 'nonneg' 2019-07-14 12:22:33 +02:00
Daniel Marjamäki 49dd2deef1 Avoid 'unsigned' in ctu 2019-07-13 20:31:50 +02:00
Daniel Marjamäki 95d65c8c34 Refactoring; enum class 2019-07-10 14:05:16 +02:00
Scott Furry a195477470 Correct Zero/Null as pointer constant (#1938)
Building with enhanced clang warnings indicated a large number of
instances with the warning:

`warning: zero as null pointer constant`

Recommended practice in C++11 is to use `nullptr` as value for
a NULL or empty pointer value. All instances where this warning
was encountered were corrected in this commit.

Where warning was encountered in dependency code (i.e. external library)
no chnages were made. Patching will be offered upstream.
2019-06-30 21:39:22 +02:00
Daniel Marjamäki 61a259597b Fix Cppcheck warnings 2019-06-15 13:28:01 +02:00
Daniel Marjamäki a7478bcb5a Add missing include 2019-05-09 06:55:36 +02:00
Daniel Marjamäki 66b2b31eb0 Fix a few useStlAlgorithm warnings 2019-05-08 20:23:32 +02:00
Daniel Marjamäki d6b806c592 CheckBufferOverrun: Better CTU checking when variable address is passed 2019-03-23 15:57:17 +01:00
Daniel Marjamäki 9653760547 CheckBufferOverrun: Improved CTU analysis for array 2019-03-23 11:20:35 +01:00
Daniel Marjamäki 15fc9a622d CheckBufferOverrun: Add CTU analysis 2019-03-23 08:36:10 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 437800f46d CLI: Added --max-ctu-depth 2019-02-03 17:51:36 +01:00
Daniel Marjamäki c75a2265c0 Fix inline suppression. 2019-01-13 12:10:26 +01:00
Daniel Marjamäki e6edd74099 Temporarily suppress Cppcheck false positives 2019-01-12 19:11:44 +01:00
Daniel Marjamäki 2b1b8f8fe9 Fix Cppcheck warnings
[ci skip]
2019-01-12 18:29:08 +01:00
Daniel Marjamäki fd8f599802 CTU: Use column in function id 2018-12-31 10:18:28 +01:00
Daniel Marjamäki aa4f61acdf CTU: Avoid FP in else block 2018-12-31 08:24:39 +01:00
Daniel Marjamäki fb6a291370 CTU: Avoid FP in code protected by &&,||,? 2018-12-31 08:16:21 +01:00
Daniel Marjamäki 5cc61e55f9 CTU: Refactoring; Use ValueFlow::Value::errorSeverity 2018-12-31 07:50:02 +01:00
amai2012 f2d7cb3ab6 Fix VS compiler warning and add a const 2018-12-30 22:17:21 +01:00
Daniel Marjamäki 91a580cbd7 CTU: more warnings 2018-12-30 18:31:37 +01:00
Daniel Marjamäki c8901e9bab CTU: Find paths better 2018-12-30 16:23:25 +01:00
Daniel Marjamäki 378e083585 CTU: Refactoring the xml load/write. Renamed members. 2018-12-30 11:55:39 +01:00
Daniel Marjamäki ee3fd0af03 Refactoring: Combine replaceStr functions 2018-12-28 13:11:54 +01:00
Daniel Marjamäki a788512d66 CTU: Refactor isUnsafeFunction 2018-12-26 19:17:49 +01:00
Daniel Marjamäki a6e227a73c CTU: Refactoring; getErrorPath 2018-12-26 15:56:10 +01:00
Daniel Marjamäki e39be48c92 CTU: Refactoring, create ErrorPath in ctu 2018-12-26 11:36:26 +01:00
Daniel Marjamäki 271763e680 CTU: Refactoring 2018-12-25 21:11:23 +01:00