1436771
From 1eeffc5daf5a06cf6213ffc19e95923cdebb2eb8 Mon Sep 17 00:00:00 2001
1436771
From: Andrew Mustun <andrew@qcad.org>
1436771
Date: Wed, 4 Aug 2021 22:32:43 +0200
1436771
Subject: [PATCH] check vertexIndex which might be -1 for broken DXF
1436771
1436771
---
1436771
 contrib/dxflib-3.17.0/src/dl_dxf.cpp | 4 ++--
1436771
 1 file changed, 2 insertions(+), 2 deletions(-)
1436771
1436771
diff --git a/contrib/dxflib-3.17.0/src/dl_dxf.cpp b/contrib/dxflib-3.17.0/src/dl_dxf.cpp
1436771
index c31d68f5a2..5df93924a3 100644
1436771
--- a/contrib/dxflib-3.17.0/src/dl_dxf.cpp
1436771
+++ b/contrib/dxflib-3.17.0/src/dl_dxf.cpp
1436771
@@ -1448,10 +1448,10 @@ bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/) {
1436771
         }
1436771
 
1436771
         if (groupCode<=30) {
1436771
-            if (vertexIndex>=0 && vertexIndex
1436771
+            if (vertexIndex>=0 && vertexIndex<maxVertices && vertexIndex>=0) {
1436771
                 vertices[4*vertexIndex + (groupCode/10-1)] = toReal(groupValue);
1436771
             }
1436771
-        } else if (groupCode==42 && vertexIndex
1436771
+        } else if (groupCode==42 && vertexIndex<maxVertices && vertexIndex>=0) {
1436771
             vertices[4*vertexIndex + 3] = toReal(groupValue);
1436771
         }
1436771
         return true;