summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmParseJacocoCoverage.cxx
diff options
context:
space:
mode:
authorSylvain Joubert <joubert.sy@gmail.com>2019-03-26 09:52:57 (GMT)
committerBrad King <brad.king@kitware.com>2019-03-26 15:50:30 (GMT)
commit1d16eae868b2542789de9d2b6224c8d3185540d4 (patch)
treecef4d99a252cf96b015e2d7a15c2d6776120c06c /Source/CTest/cmParseJacocoCoverage.cxx
parentbf02d625325535f485512eba307cff54c08bb257 (diff)
downloadCMake-1d16eae868b2542789de9d2b6224c8d3185540d4.zip
CMake-1d16eae868b2542789de9d2b6224c8d3185540d4.tar.gz
CMake-1d16eae868b2542789de9d2b6224c8d3185540d4.tar.bz2
ctest_coverage: fix out-of-bounds index in Jacoco parser
When the current source file is not found the FilePath variable was left with the previous path content. In case the previous file had less lines than the current one and there are 'line' entries for the current one with higher number we ended up in a buffer overflow while indexing the previous file entry with a line number higher. By clearing the FilePath, the empty() guard triggers correctly on an empty path and it avoid modifying the wrong data.
Diffstat (limited to 'Source/CTest/cmParseJacocoCoverage.cxx')
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index 61c5dcb..b78142a 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -29,6 +29,7 @@ protected:
this->PackageName = atts[1];
this->PackagePath.clear();
} else if (name == "sourcefile") {
+ this->FilePath.clear();
std::string fileName = atts[1];
if (this->PackagePath.empty()) {