[clang] [analyzer] Improve handling of unsigned values in ArrayBoundCheckerV2 (PR #81034)

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 06:22:43 PST 2024


NagyDonat wrote:

I did an open source evaluation of this commit and there are surprisingly many changes:

| Project | With this commit | Without this commit |
|---------|-------------|------------------|
| memcached | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=memcached_1.6.8_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=memcached_1.6.8_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=memcached_1.6.8_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=memcached_1.6.8_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| tmux | No new reports | No resolved reports |
| curl | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=curl_curl-7_66_0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=curl_curl-7_66_0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=curl_curl-7_66_0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=curl_curl-7_66_0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| twin | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=twin_v0.8.1_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=twin_v0.8.1_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=twin_v0.8.1_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=twin_v0.8.1_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| vim | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=vim_v8.2.1920_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=vim_v8.2.1920_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=vim_v8.2.1920_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=vim_v8.2.1920_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| openssl | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=openssl_openssl-3.0.0-alpha7_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=openssl_openssl-3.0.0-alpha7_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=openssl_openssl-3.0.0-alpha7_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=openssl_openssl-3.0.0-alpha7_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| sqlite | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=sqlite_version-3.33.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=sqlite_version-3.33.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=sqlite_version-3.33.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=sqlite_version-3.33.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| ffmpeg | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=ffmpeg_n4.3.1_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=ffmpeg_n4.3.1_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=ffmpeg_n4.3.1_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=ffmpeg_n4.3.1_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| postgres | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=postgres_REL_13_0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=postgres_REL_13_0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=postgres_REL_13_0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=postgres_REL_13_0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| tinyxml2 | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=tinyxml2_8.0.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=tinyxml2_8.0.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=tinyxml2_8.0.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=tinyxml2_8.0.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| libwebm | No new reports | No resolved reports |
| xerces | No new reports | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=xerces_v3.2.3_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=xerces_v3.2.3_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| bitcoin | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=bitcoin_v0.20.1_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=bitcoin_v0.20.1_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=bitcoin_v0.20.1_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=bitcoin_v0.20.1_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| protobuf | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=protobuf_v3.13.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=protobuf_v3.13.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=protobuf_v3.13.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=protobuf_v3.13.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| qtbase | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=qtbase_v6.2.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=qtbase_v6.2.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=qtbase_v6.2.0_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=qtbase_v6.2.0_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| contour | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=contour_v0.2.0.173_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=contour_v0.2.0.173_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=contour_v0.2.0.173_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=contour_v0.2.0.173_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| acid | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=acid_2022-08-02-codechecker-test_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=acid_2022-08-02-codechecker-test_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=acid_2022-08-02-codechecker-test_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=acid_2022-08-02-codechecker-test_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |
| openrct2 | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=openrct2_null_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=openrct2_null_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=New&is-unique=on) | [View](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=openrct2_null_without_arrayboundv2_generalize_negative_vs_unsigned&newcheck=openrct2_null_with_arrayboundv2_generalize_negative_vs_unsigned&diff-type=Resolved&is-unique=on) |

Note that currently `alpha.security.ArrayBoundV2` activates at a point that's just before the activation of `alpha.security.ArrayBound` so when this commit blocks/disables many `ArrayBoundV2` reports (that are probably incorrect), many of those issues will reappear as `ArrayBound` (V1) reports.

https://github.com/llvm/llvm-project/pull/81034


More information about the cfe-commits mailing list