Inform - Support - Patches

About Patches  


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: -

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);\


  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 web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Roger Firth.