From 8e00f3ae2e40b72bed291437883cc8a8a4dfdf7d Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Sat, 11 Apr 2020 10:58:16 +0200 Subject: [PATCH] [GL/IO] Avoid use after move. Points were accessed and moved in a for-loop. Second iteration would result in access after move. --- GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp index f23e4bbc864..f24722bd472 100644 --- a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp @@ -45,12 +45,10 @@ bool BoostXmlGmlInterface::readFile(const std::string &fname) doc->ignoreConfigAttribute("xsi:noNamespaceSchemaLocation"); doc->ignoreConfigAttribute("xmlns:ogs"); - auto points = std::make_unique<std::vector<GeoLib::Point*>>(); auto polylines = std::make_unique<std::vector<GeoLib::Polyline*>>(); auto surfaces = std::make_unique<std::vector<GeoLib::Surface*>>(); using MapNameId = std::map<std::string, std::size_t>; - auto pnt_names = std::make_unique<MapNameId>(); auto ply_names = std::make_unique<MapNameId>(); auto sfc_names = std::make_unique<MapNameId>(); @@ -64,6 +62,8 @@ bool BoostXmlGmlInterface::readFile(const std::string &fname) //! \ogs_file_param{gml__points} for (auto st : doc->getConfigSubtreeList("points")) { + auto points = std::make_unique<std::vector<GeoLib::Point*>>(); + auto pnt_names = std::make_unique<MapNameId>(); readPoints(st, *points, *pnt_names); _geo_objects.addPointVec(std::move(points), geo_name, std::move(pnt_names)); -- GitLab