You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
We did some tricks to add a feature while maintaining binary compatibility. I'm pretty sure that any 2 CZStrings compared with each other will always be either both cstr or both index. Maybe we could shut up the compiler with an assertion?
ya1gaurav
added a commit
to ya1gaurav/jsoncpp
that referenced
this issue
Mar 1, 2016
As per discussion in - open-source-parsers#404
Null should not be pass to memcmp, it may show undesired behaviour, so avoid doing that using assertion.
Also, changed one direct "assert" to JSON_ASSERT - it will be decided if exceptions are used or not.
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.
The text was updated successfully, but these errors were encountered: