summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileCache.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-02-19 17:26:44 (GMT)
committerBrad King <brad.king@kitware.com>2017-02-27 14:14:28 (GMT)
commitded616bdad46a445ea7ae05d47ae8f32026b13b5 (patch)
treeba3a048d94b1aadb5fb728885fbd9b02bc691ba9 /Source/cmListFileCache.cxx
parent32cb4172bd6b98810f9638076e978a6bc569f6ae (diff)
downloadCMake-ded616bdad46a445ea7ae05d47ae8f32026b13b5.zip
CMake-ded616bdad46a445ea7ae05d47ae8f32026b13b5.tar.gz
CMake-ded616bdad46a445ea7ae05d47ae8f32026b13b5.tar.bz2
cmListFileLexer: bail out on seek-errors
If we are given a FIFO, for example, we cannot seek back after trying to read a Byte-Order-Mark. Closes: #16607
Diffstat (limited to 'Source/cmListFileCache.cxx')
-rw-r--r--Source/cmListFileCache.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index b1cd889..23b666e 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -80,6 +80,13 @@ bool cmListFileParser::ParseFile()
return false;
}
+ if (bom == cmListFileLexer_BOM_Broken) {
+ cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR);
+ this->IssueFileOpenError("Error while reading Byte-Order-Mark. "
+ "File not seekable?");
+ return false;
+ }
+
// Verify the Byte-Order-Mark, if any.
if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) {
cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR);