-
- Downloads
file(GENERATE): Restore INPUT|CONTENT parse checking
Refactoring in commit bff468c9 (cmFileCommand: Use cm::optional for keyword argument presence, 2022-06-30, v3.25.0-rc1~512^2) accidentally broke the check that the input argument is either `INPUT` or `CONTENT`. The check is supposed to fail when arguments are passed in the wrong order. For example: file(GENERATE OUTPUT ... TARGET <target> CONTENT <content>) Prior to this fix, the input method would be CONTENT, but because the first parsed keyword is not `CONTENT`, `inputIsContent` would be false. The first parsed keyword isn't INPUT either, so we would not continue into the error condition. CMake would then try to handle this as an input file, when there isn't one, resulting in uninitialized memory usage and segfaults or corruption later on. Fixes: #25169
Showing
- Source/cmFileCommand.cxx 2 additions, 1 deletionSource/cmFileCommand.cxx
- Tests/RunCMake/File_Generate/OutOfOrderArgs-result.txt 1 addition, 0 deletionsTests/RunCMake/File_Generate/OutOfOrderArgs-result.txt
- Tests/RunCMake/File_Generate/OutOfOrderArgs-stderr.txt 4 additions, 0 deletionsTests/RunCMake/File_Generate/OutOfOrderArgs-stderr.txt
- Tests/RunCMake/File_Generate/OutOfOrderArgs.cmake 4 additions, 0 deletionsTests/RunCMake/File_Generate/OutOfOrderArgs.cmake
- Tests/RunCMake/File_Generate/RunCMakeTest.cmake 1 addition, 0 deletionsTests/RunCMake/File_Generate/RunCMakeTest.cmake
Loading
Please register or sign in to comment