From 1807aec2a71f34103a4d73803117aa15a467359f Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 8 Jan 2016 01:32:57 +0000 Subject: [PATCH] C-CON: Fix VM_ScriptInfo so that it never reads before the beginning of the bytecode. git-svn-id: https://svn.eduke32.com/eduke32@5520 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gameexec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index d0632f724..478441bf4 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -104,11 +104,8 @@ extern void VM_ScriptInfo(intptr_t const *ptr, int32_t range) { initprintf("\n"); - for (intptr_t const *p = ptr - (range>>1); p < ptr + (range>>1); p++) + for (intptr_t const *p = max(ptr - (range>>1), script), *p_end = min(ptr + (range>>1), script + g_scriptSize); p < p_end; p++) { - if ((int32_t)(p - script) >= g_scriptSize) - break; - initprintf("%5d: %3d: ", (int32_t) (p - script), (int32_t) (p - ptr)); if (*p >> 12 && (*p & VM_INSTMASK) < CON_END)