]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: update "tainted" state of RHS in comparisons [PR106373]
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 20 Jul 2022 21:25:35 +0000 (17:25 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 20 Jul 2022 21:25:35 +0000 (17:25 -0400)
commit5e830693dd335621940368b6d39b23afc2c98545
tree49b7ba4fee1d65b5600b5ed096e91313efa8d456
parent26bbe78f77f73bb66af1ac13d0deec888a3c6510
analyzer: update "tainted" state of RHS in comparisons [PR106373]

Doing so fixes various false positives from
-Wanalyzer-tainted-array-index at -O1 and above (e.g. seen on the
Linux kernel)

gcc/analyzer/ChangeLog:
PR analyzer/106373
* sm-taint.cc (taint_state_machine::on_condition): Potentially
update the state of the RHS as well as the LHS.

gcc/testsuite/ChangeLog:
PR analyzer/106373
* gcc.dg/analyzer/torture/taint-read-index-3.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/sm-taint.cc
gcc/testsuite/gcc.dg/analyzer/torture/taint-read-index-3.c [new file with mode: 0644]