Redefining a class and accessing an old selector/variable can abort the VM
Project: | GNU Smalltalk |
Component: | VM |
Category: | bug |
Priority: | normal |
Assigned: | Unassigned |
Status: | active |
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
RedefineCrash.st:31: Bytecode verification failed: receiver variable out of range
RedefineCrash.st:31: Method verification failed for OMLSubclass>>#admState:
RedefineCrash.st:31: Aborted
(ip 20)UndefinedObject>>#executeStatements
(ip 0)
Aborted
Updates
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").
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.