false positive for squid:S3518

41 views
Skip to first unread message

kres...@gmail.com

unread,
Apr 23, 2018, 8:29:09 AM4/23/18
to SonarQube
Hi,

I use SonarCube for Java code and it gives me critical bug in following method:

   private double doSomething()
  {
     int divider = 0;
     int dividend = 0;
     for ( int i = 1; i <= 2; ++i )
     {
        divider = 1;
     }
     return dividend / divider;
  }

Thanks in andance
Ewa

Nicolas Peru

unread,
Apr 27, 2018, 10:33:32 AM4/27/18
to kres...@gmail.com, SonarQube
Hi, 

This is a limitation of the current symbolic execution engine which does not deal with precise integer values. As such there is one path that is explored while unfeasible : the loop is not executed.

This is a variation of this problem : https://jira.sonarsource.com/browse/SONARJAVA-2606

Cheers, 



--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/cb555977-5efd-462d-bba2-ec0148f5a4bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource
Reply all
Reply to author
Forward
0 new messages