[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

inconsistent null-ptr handling in utf-path related functions

From: Stefan <luke1410_at_gmx.de>
Date: Mon, 25 Jan 2016 22:30:40 +0100


looking through the code, I'm wondering that there's some inconsistent
behavior/handling with regards to calling certain svn_utf-functions with
a nullptr.

svn_utf__cstring_is_valid() for instance does a nullptr check against
the provided data and returns FALSE in that case.
However, the callers of this function do not seem to handle that case then:

svn_fs__path_valid(): uses the path then to generate the error output
check_cstring_utf8(): uses it in the strlen()-call
svn_utf_cstring_utf8_width(): accesses the cstr before calling
svn_utf__cstring_is_valid() so that even if it would be determined to be
FALSE due to a nullptr, there would have already been an invalid access

I'm not too sure what the API promise is here, but IMO either the
nullptr-check in svn_utf__cstring_is_valid() is unnecessary or the
callers are missing the appropriate handling there.

Received on 2016-01-25 22:30:51 CET

This is an archived mail posted to the Subversion Dev mailing list.