github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.76k stars 1.56k forks source link

LGTM.com - false positive - missed conditional increment of a variable #3791

Open mlangsdorf opened 4 years ago

mlangsdorf commented 4 years ago

Description of the false positive I keep getting a "Comparison is always false because dif_steering <= 0." error on https://lgtm.com/projects/g/CleverRaven/Cataclysm-DDA/rev/pr-f7153dbafa3dbb084b7793d0d2ac10ebda2bca84

in https://lgtm.com/projects/g/CleverRaven/Cataclysm-DDA/snapshot/912bd27fe5b356ed2a34f3ce5b19e63ad5c9c4cd/files/src/veh_interact.cpp?sort=name&dir=ASC&mode=heatmap#L737, it's clear that dif_steering can be incremented to be more than 5, so this result is in error.

Also, I didn't actually change this part of the file, so I even if there was a false positive, I shouldn't be getting warned about it for this particular PR.

https://lgtm.com/projects/g/CleverRaven/Cataclysm-DDA/rev/pr-f7153dbafa3dbb084b7793d0d2ac10ebda2bca84

jbj commented 4 years ago

Thank you for the report. I agree it's a false positive. Can you ping me when the PR has been merged? Then it'll be easier to investigate the problem because all the intermediate data used for analysis won't get deleted.