diff --git a/solo.c b/solo.c index c7ed61b..789d68f 100644 --- a/solo.c +++ b/solo.c @@ -3849,7 +3849,11 @@ static char *spec_to_dsf(const char **pdesc, int **pdsf, int cr, int area) * Non-edge; merge the two dsf classes on either * side of it. */ - assert(pos < 2*cr*(cr-1)); + if (pos >= 2*cr*(cr-1)) { + sfree(dsf); + return "Too much data in block structure specification"; + } + if (pos < cr*(cr-1)) { int y = pos/(cr-1); int x = pos%(cr-1);