Menu

Cppcheck-1.82

We have released Cppcheck-1.82. The release notes are:

Bug fixes:

  • Better handling of namespaces
  • Fixed false positives
  • Fixed parsing of compile databases
  • Fixed parsing of visual studio projects

Enhancements

  • New check; Detect mistakes when there are multiple strcmp() in condition
    Example:
       if (strcmp(password,"A")==0 || strcmp(password,"B")==0 || strcmp(password,"C"))

There is a missing '==0', and therefore this condition is always true except when password is "C".

  • New check; pointer calculation result can't be NULL unless there is overflow
    Example:
       someType **list_p = ...;
       if ((list_p + 1) == NULL)

The result for '(list_p + 1)' can't be NULL unless there is overflow (UB).

  • New check; public interface of classes should be safe - detect possible division by zero
    Example:
       class Fred {
       public:
           void setValue(int mul, int div) {
               value = mul / div; // <- unsafe
           }
           ...

This check does not consider how Fred::setValue() is really called. If you agree that the public interface of classes should always be safe; it should be allowed to call all public methods with arbitrary arguments, then this checker will be useful.

  • Fixed a few false negatives

  • More information in the cfg files

Posted by Daniel Marjamäki 2018-01-14

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.