From 7cf893fe81469f7c546ecf9e25dbad63e9d287fc Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 26 Apr 2022 15:26:29 +0200 Subject: [PATCH] Fix memory corruption in svg parsing --- src/libslic3r/Format/SL1_SVG.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Format/SL1_SVG.cpp b/src/libslic3r/Format/SL1_SVG.cpp index 46e5f2acb4..f8b93a8bac 100644 --- a/src/libslic3r/Format/SL1_SVG.cpp +++ b/src/libslic3r/Format/SL1_SVG.cpp @@ -278,8 +278,9 @@ ConfigSubstitutions SL1_SVGReader::read(std::vector &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(entry.buf.size()); + auto svgtxt = reserve_vector(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;