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
This commit is contained in:
hendricks266 2016-01-08 01:32:57 +00:00
parent d3f9244d66
commit 1807aec2a7

View file

@ -104,11 +104,8 @@ extern void VM_ScriptInfo(intptr_t const *ptr, int32_t range)
{ {
initprintf("\n"); 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)); initprintf("%5d: %3d: ", (int32_t) (p - script), (int32_t) (p - ptr));
if (*p >> 12 && (*p & VM_INSTMASK) < CON_END) if (*p >> 12 && (*p & VM_INSTMASK) < CON_END)