From 9c462b2334307abc2d0222301e4e6b171d8c7bc3 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 27 Apr 2023 22:48:58 +0200 Subject: [PATCH] prevented crashes while using incorrect gpside --- graph.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/graph.cpp b/graph.cpp index 7253b783..cd189c73 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3771,6 +3771,14 @@ EX bool placeSidewall(cell *c, int i, int sidepar, const shiftmatrix& V, color_t if(currentmap->strict_tree_rules()) { i = rulegen::get_arb_dir(c, i); } + if(sidepar >= SIDEPARS) { + println(hlog, "ERROR: sidepar >= SIDEPARS", make_pair(sidepar, SIDEPARS)); + return false; + } + if(i >= isize(qfi.fshape->gpside[sidepar])) { + println(hlog, "ERROR: i >= gpside[sidepar]", make_tuple(sidepar, i, isize(qfi.fshape->gpside[sidepar]))); + return false; + } draw_shapevec(c, V2, qfi.fshape->gpside[sidepar][i], col, prio); return false; }