[CMake] cmLocalGenerator.cxx is bugy

Brad King brad.king at kitware.com
Mon Jun 23 09:47:48 EDT 2014


On 06/22/2014 08:57 AM, Richard Wirth wrote:
> In line 1865 of the above mentioned file there is a conversion from
> const char* to string&  . When char* is NULL it crashes. The NULL comes
> as return from GetDefinition().

This problem was caused by refactoring in commit:

 stringapi: Pass configuration names as strings
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=84fdc9921

Since then we've found a few other places that forget to switch NULL
to empty string.  This looks like another, thanks.  I've fixed it
along with the rest of the places that call GetDefinition for
CMAKE_BUILD_TYPE without checking the result:

 Fix some generator crashes on undefined CMAKE_BUILD_TYPE
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c491cb1e

> Then I searched all the files of the project for a occurrence of
> GetDefinition(). And I've found other codings of this possible error.
> For instance in cmComputeLinkInformation.cxx line 880 and many others.

That location checks the return value before use AFAICT, but without
knowing the exact version you have checked out from Git I do not know
if I'm looking at the same line of code.

Thanks,
-Brad



More information about the CMake mailing list