Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C63008     [previous patch]

Construct obj.prop crashes for large prop values
Submitted by: Roger Firth     Appeared in: Compiler 6.30 or before     Fixed in: -
Problem

It seems that the construct obj.prop can crash at run-time; it should complain if either obj or prop is too large.

Solution (by Cedric Knight)

And usually does regardless of whether Strict mode is on or off. The crash arises when 16384 <= prop < 32768, and the superclass implementation in veneer routine RA__Pr is triggered:

  if (identifier & $4000 ~= 0)\
      {   cla = #classes_table-->(identifier & $ff);\

Inserting

  if (cla > #largest_object-255 || cla < 1 || cla notin Class) rfalse;\

at this point will usually stop the routine returning a bogus address, and result in an only slightly misleading error

  [**Programming error: thing (object number 5) has no property
  (string at 1318)::<number 2> (and nor has any other object) to send message

That could be fixed by putting a similar check in Print__PName, so it reads

  cla = #classes_table-->(prop & $ff);\
  if (prop & $c000 && cla <= #largest_object-255 && cla > 0 && cla in Class) {\
      print (name) cla, \"::\";\

I haven't checked whether the superclass operator still works perfectly, but it should. I also wonder whether the check in RA__Pr a few lines earlier needs something similar, and what happens with the superclass operator when the property number is greater than 255.


Last updated 17 April 2013. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Roger Firth.