Fix memory corruption in svg parsing

This commit is contained in:
tamasmeszaros 2022-04-26 15:26:29 +02:00
parent 4148d7332e
commit 7cf893fe81

View file

@ -278,8 +278,9 @@ ConfigSubstitutions SL1_SVGReader::read(std::vector<ExPolygons> &slices,
// Don't want to use dirty casts for the buffer to be usable in
// the NanoSVGParser until performance is not a bottleneck here.
auto svgtxt = reserve_vector<char>(entry.buf.size());
auto svgtxt = reserve_vector<char>(entry.buf.size() + 1);
std::copy(entry.buf.begin(), entry.buf.end(), std::back_inserter(svgtxt));
svgtxt.emplace_back('\0');
NanoSVGParser svgp(svgtxt.data());
Polygons polys;