microsoft / infersharp

Infer# is an interprocedural and scalable static code analyzer for C#. Via the capabilities of Facebook's Infer, this tool detects null dereferences, resource leaks, and thread-safety violations. It also performs taint flow tracking to detect critical security vulnerabilities like SQL injections.
MIT License
732 stars 29 forks source link

Bug Patch for Casting Exception in ldarg/stloc/ldloc #103

Closed matjin closed 2 years ago

matjin commented 2 years ago

This patch introduces a bug fix for the scenario where the instruction operand (ldarg/stloc/ldloc) is not an integer, but rather a Cecil object.

xi-liu-ds commented 2 years ago

General question: do you have a unit test to test what was fixed? Does it mitigate any false positives?

xi-liu-ds commented 2 years ago

And this PR seems to have some duplicate changes from this PR. Could you keep either this one or that one and abandon the other?

matjin commented 2 years ago

General question: do you have a unit test to test what was fixed? Does it mitigate any false positives?

Not really an easy way to test this -- it was observed within an X++ netmodule, so we would have to make a whole project for that. Not a false positive so much as literally not being able to translate these instructions quite frequently -- a substantial and unnecessary reduction in coverage

matjin commented 2 years ago

And this PR seems to have some duplicate changes from this PR. Could you keep either this one or that one and abandon the other?

It is actually intentional. 105 derives from 103. By checking in 103 before 105, we get a cleaner commit history that shows the incremental diffs. We want to check in 103, then we check in 105.