Skip to content

1.82

Compare
Choose a tag to compare
@danmar danmar released this 14 Jan 21:37

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