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.
This commit is contained in:
Sylvain Joubert
2019-03-26 10:52:57 +01:00
committed by Brad King
parent bf02d62532
commit 1d16eae868

View File

@@ -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()) {