summaryrefslogtreecommitdiff
path: root/Source/cmListFileCache.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-02-19 18:26:44 +0100
committerBrad King <brad.king@kitware.com>2017-02-27 09:14:28 -0500
commitded616bdad46a445ea7ae05d47ae8f32026b13b5 (patch)
treeba3a048d94b1aadb5fb728885fbd9b02bc691ba9 /Source/cmListFileCache.cxx
parent32cb4172bd6b98810f9638076e978a6bc569f6ae (diff)
downloadcmake-ded616bdad46a445ea7ae05d47ae8f32026b13b5.tar.gz
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 b1cd8891ad..23b666ea61 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);