From 1d16eae868b2542789de9d2b6224c8d3185540d4 Mon Sep 17 00:00:00 2001 From: Sylvain Joubert Date: Tue, 26 Mar 2019 10:52:57 +0100 Subject: 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. --- Source/CTest/cmParseJacocoCoverage.cxx | 1 + 1 file changed, 1 insertion(+) 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()) { -- cgit v0.12