mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-10 17:14:10 +00:00
QCMake::setPreset() bound a reference to the selected preset's expanded data inside CMakePresetsGraph.ConfigurePresets and then called setBinaryDirectory(). When the selected preset's build directory holds a cache whose CMAKE_HOME_DIRECTORY differs from the current source directory (e.g. because the source path is reached through a symbolic link, since browsing keeps the link unresolved while the cache stores the real path), setBinaryDirectory() loads that cache and re-sets the source directory. That re-reads the presets graph via loadPresets(), which calls ClearPresets() and destroys the map entry, leaving the reference dangling. Subsequent access crashed with a use-after-free. Copy the expanded preset instead of holding a reference into the graph so it stays valid across setBinaryDirectory(). Fixes: #27927