From becc00a8be579bc7610aafe69d4d5b7199561ac3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 1 Feb 2017 21:40:47 +0100 Subject: [PATCH] - added a check to P_VerifyBlockmap to discard all blockmap with blocks whose first entry is not 0. Seems someone has written a node builder which violates this long-standing assumption (https://www.doomworld.com/vb/source-ports/92468-introducing-zokumbsp/) However, rather than second-guessing the format's correctness it's more advisable to just discard such blockmaps to avoid some less obvious issues that may creep up. --- src/p_setup.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 18b3966c7..0c3b65710 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2978,6 +2978,15 @@ static bool P_VerifyBlockMap(int count) break; } + // there's some node builder which carelessly removed the initial 0-entry. + // Rather than second-guessing the intent, let's just discard such blockmaps entirely + // to be on the safe side. + if (*list != 0) + { + Printf(PRINT_HIGH, "P_VerifyBlockMap: first entry is not 0.\n"); + return false; + } + // scan the list for out-of-range linedef indicies in list for(tmplist = list; *tmplist != -1; tmplist++) {