From 29f9fb7a68a7d8dab8bf6f9cef530c0066a20992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 13 Jul 2021 19:58:12 +0200 Subject: [PATCH] Some more error checking --- src/map/mapsforge/style.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/map/mapsforge/style.cpp b/src/map/mapsforge/style.cpp index 72d72e1c..31bc90a1 100644 --- a/src/map/mapsforge/style.cpp +++ b/src/map/mapsforge/style.cpp @@ -143,8 +143,13 @@ void Style::line(QXmlStreamReader &reader, const Rule &rule) if (attr.hasAttribute("stroke-dasharray")) { QStringList l(attr.value("stroke-dasharray").toString().split(',')); ri._strokeDasharray.resize(l.size()); - for (int i = 0; i < l.size(); i++) - ri._strokeDasharray[i] = l.at(i).toDouble(); + for (int i = 0; i < l.size(); i++) { + ri._strokeDasharray[i] = l.at(i).toDouble(&ok); + if (!ok || ri._strokeDasharray[i] < 0) { + reader.raiseError("invalid stroke-dasharray value"); + return; + } + } } if (attr.hasAttribute("stroke-linecap")) { QString cap(attr.value("stroke-linecap").toString());