Redefining a class and accessing an old selector/variable can abort the VM

Project:GNU Smalltalk

The attached code redefines a class (by accident) and using the old selectors will lead to an abort.

a Smalltalk string:2: assignment to undeclared variable adm_state
a Smalltalk string:2: assignment to undeclared variable op_state Bytecode verification failed: receiver variable out of range Method verification failed for OMLSubclass>>#admState: Aborted
(ip 20)UndefinedObject>>#executeStatements
(ip 0)


#1 submitted by Paolo Bonzini on Thu, 08/02/2012 - 13:24

It's not nice, but I don't think it's a bug (only a QoI issue). The bytecode is indeed invalid.

One alternative is to rewrite the bytecodes to something that fails more nicely (for example adding a primitive that does "self invalidInstanceVariableAccess").

#2 submitted by Holger Hans Pet... on Tue, 08/28/2012 - 20:44

Sounds reasonable. E.g if you use GST as scripting language of an app it is not too nice that it can take down the entire application.

The alternative/on top of that is to pay the price on loading. It would be nice to have an advanced >>#fileIn: that will diff the classes and remove the missing selectors, find selectors that access removed variables, etc.

User login