Skip to content

Clang Analyzer warning - null pointer passed as an argument #404

@Jesse-V

Description

@Jesse-V

jsoncpp/jsoncpp.cpp:2629:14: warning: Null pointer passed as an argument to a 'nonnull' parameter
int comp = memcmp(this->cstr_, other.cstr_, this_len);
_________^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

I'm using Fedora 23, Clang 3.7 and the 1.6.5 release of jsoncpp. The line in question occurs in the "bool Value::CZString::operator==(const CZString& other) const" method. It's not obvious to me which argument is null, but there does seem to be an existence check for cstr_, so it must be either "other.cstr_" or "this_len". This could also be a false positive, but it's probably worth investigating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions