Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C63110     [previous patch]

Crash when grammar table exceeds readable memory
Submitted by: Jesse McGrew     Appeared in: Compiler 6.31 or before     Fixed in: -
Problem

There is an issue where Inform crashes during backpatching, after reporting that the story file has exceeded readable memory, but before printing the memory map.

Backpatching requires the compiler to trust some of the addresses that it previously wrote into Z-machine memory, but in this case those addresses have been truncated to 16 bits, causing unpredictable behavior as Inform interprets the entirety of Z-machine memory as one big grammar line.

Solution

Apply the following patch:

*** tables.c.orig	Sun Dec 31 05:45:04 2006
--- tables.c	Sun Dec 31 06:03:21 2006
***************
*** 233,238 ****
--- 233,239 ----
            abbrevs_at, prop_defaults_at, object_tree_at, object_props_at,
            map_of_module, grammar_table_at, charset_at, headerext_at,
            terminating_chars_at, unicode_at, id_names_length;
+     int skip_backpatching = FALSE;
      char *output_called = (module_switch)?"module":"story file";

      ASSERT_ZCODE();
***************
*** 592,597 ****
--- 593,602 ----
  of the area marked \"above readable memory\" must be brought down to $10000 \
  or less.");
          memory_map_switch = TRUE;
+         /* Backpatching the grammar tables requires us to trust some of the */
+         /* addresses we've written into Z-machine memory, but they may have */
+         /* been truncated to 16 bits, so we can't do it.                    */
+         skip_backpatching = TRUE;
      }

      /*  -------------------------- Code Area ------------------------------- */
***************
*** 821,827 ****

      /*  ---- Backpatch the Z-machine, now that all information is in ------- */

!     if (!module_switch)
      {   backpatch_zmachine_image_z();
          for (i=1; i<id_names_length; i++)
          {   int32 v = 256*p[identifier_names_offset + i*2]
--- 826,832 ----

      /*  ---- Backpatch the Z-machine, now that all information is in ------- */

!     if (!module_switch && !skip_backpatching)
      {   backpatch_zmachine_image_z();
          for (i=1; i<id_names_length; i++)
          {   int32 v = 256*p[identifier_names_offset + i*2]


Last updated 2 May 2008. The librarian in charge of this page is Roger Firth. Please email any comments, suggestions or corrections to roger@firthworks.com.