https://github.com/Kitware/CMake
Revision c61040282557ba268e144ffa5e2d1935b5991d8d authored by Yves Frederix on 23 March 2016, 09:37:51 UTC, committed by Brad King on 23 March 2016, 20:17:36 UTC
Re-lookup a variable value when an associated VariableWatch is executed in cmMakefile::GetDefinition. This fixes a problem with 'def' sometimes becoming invalid due to memory reallocation inside an std::vector. In this case, the problem was that if the call to VariableAccessed actually executed a callback function, the internal state of the makefile has changed due to the associated function scope being pushed. This in turn implies that a new cmDefinitions instance was pushed in cmMakefile::VarTree. As cmLinkedTree is based on an std::vector, this push can have triggered reallocation of its internal memory buffer. However, as the value of 'def', which was computed on method entry, actually points to a property of one of the cmDefinitions instances in cmMakefile::VarTree, reallocation can invalidate the value of 'def' so that it cannot simply be returned at the end of the function. The solution implemented here is to simply lookup the value of 'def' again.
1 parent b369959
Tip revision: c61040282557ba268e144ffa5e2d1935b5991d8d authored by Yves Frederix on 23 March 2016, 09:37:51 UTC
Avoid occasional use-after-free when a variable watch is executed
Avoid occasional use-after-free when a variable watch is executed
Tip revision: c610402
File | Mode | Size |
---|---|---|
Auxiliary | ||
Help | ||
Licenses | ||
Modules | ||
Packaging | ||
Source | ||
Templates | ||
Tests | ||
Utilities | ||
.gitattributes | -rw-r--r-- | 613 bytes |
.hooks-config.bash | -rw-r--r-- | 866 bytes |
CMakeCPack.cmake | -rw-r--r-- | 8.8 KB |
CMakeCPackOptions.cmake.in | -rw-r--r-- | 11.0 KB |
CMakeGraphVizOptions.cmake | -rw-r--r-- | 153 bytes |
CMakeLists.txt | -rw-r--r-- | 26.2 KB |
CMakeLogo.gif | -rw-r--r-- | 4.4 KB |
CONTRIBUTING.rst | -rw-r--r-- | 1005 bytes |
CTestConfig.cmake | -rw-r--r-- | 870 bytes |
CTestCustom.cmake.in | -rw-r--r-- | 5.1 KB |
CompileFlags.cmake | -rw-r--r-- | 3.1 KB |
Copyright.txt | -rw-r--r-- | 2.6 KB |
DartConfig.cmake | -rw-r--r-- | 804 bytes |
README.rst | -rw-r--r-- | 2.9 KB |
bootstrap | -rwxr-xr-x | 45.5 KB |
cmake_uninstall.cmake.in | -rw-r--r-- | 790 bytes |
configure | -rwxr-xr-x | 99 bytes |
doxygen.config | -rw-r--r-- | 27.4 KB |
Computing file changes ...