diff options
author | Brad King <brad.king@kitware.com> | 2018-06-26 15:51:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-06-26 15:54:34 (GMT) |
commit | b29842a818ea978a85c0646cd3c2b3191b0498fc (patch) | |
tree | 3367b225f72c3fa1d5bb8f903273a037122b36e0 /Tests/RunCMake/Syntax | |
parent | ef5e2e8a62982ebccf4883fc7a01cdb66f8ca183 (diff) | |
download | CMake-b29842a818ea978a85c0646cd3c2b3191b0498fc.zip CMake-b29842a818ea978a85c0646cd3c2b3191b0498fc.tar.gz CMake-b29842a818ea978a85c0646cd3c2b3191b0498fc.tar.bz2 |
ListFileLexer: Do not match null bytes in input
Extend the fix from commit v3.10.0-rc1~188^2 (ListFileLexer: fix
heap-buffer-overflow on malicious input, 2017-08-26) to apply to all
lexer token matches. Replace all `.` with `[^\0\n]`. Update all
`[^...]` match expressions to not match `\0`.
We cannot safely process null bytes in strings.
Fixes: #18124
Diffstat (limited to 'Tests/RunCMake/Syntax')
-rw-r--r-- | Tests/RunCMake/Syntax/NullAfterBackslash-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Syntax/NullAfterBackslash-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Syntax/NullAfterBackslash.cmake | bin | 0 -> 113 bytes | |||
-rw-r--r-- | Tests/RunCMake/Syntax/RunCMakeTest.cmake | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/Tests/RunCMake/Syntax/NullAfterBackslash-result.txt b/Tests/RunCMake/Syntax/NullAfterBackslash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NullAfterBackslash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NullAfterBackslash-stderr.txt b/Tests/RunCMake/Syntax/NullAfterBackslash-stderr.txt new file mode 100644 index 0000000..e7ba440 --- /dev/null +++ b/Tests/RunCMake/Syntax/NullAfterBackslash-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NullAfterBackslash.cmake:1: + Parse error. Function missing ending "\)". Instead found bad character + with text "\\". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/NullAfterBackslash.cmake b/Tests/RunCMake/Syntax/NullAfterBackslash.cmake Binary files differnew file mode 100644 index 0000000..ed96904 --- /dev/null +++ b/Tests/RunCMake/Syntax/NullAfterBackslash.cmake diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index 628df91..b8f5fd0 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -55,6 +55,7 @@ run_cmake(BracketNoSpace5) run_cmake(Escape1) run_cmake(Escape2) run_cmake(EscapeCharsAllowed) +run_cmake(NullAfterBackslash) run_cmake(NullTerminatedArgument) include("${RunCMake_SOURCE_DIR}/EscapeCharsDisallowed.cmake") run_cmake(ParenNoSpace0) |