Shouldn't new:0 fail for non-indexable classes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Shouldn't new:0 fail for non-indexable classes

Nicolai Hess-3-2
Create a class with a single instance variable.

call

AClass new:0

-> segfaults (on windows latest vm).
I can reproduce this on squeak (Squeak5.1-16549-32bit). It does not crash right away, but
I was able to crash it by debugging into the new: call.

from the comment of Behavior>>#new: , I would expect the error:

self error: self printString, ' cannot have variable sized instances'


Reply | Threaded
Open this post in threaded view
|

Re: Shouldn't new:0 fail for non-indexable classes

Eliot Miranda-2
Hi Nicolai,

On Tue, Aug 8, 2017 at 12:10 PM, Nicolai Hess <[hidden email]> wrote:
Create a class with a single instance variable.

call

AClass new:0

-> segfaults (on windows latest vm).
I can reproduce this on squeak (Squeak5.1-16549-32bit). It does not crash right away, but
I was able to crash it by debugging into the new: call.

from the comment of Behavior>>#new: , I would expect the error:

self error: self printString, ' cannot have variable sized instances'

Quite right.  Squeak and Pharo used to have a funky class DirectoryEntry that was expected to be able to be instantiated with DirectoryEntry new: 0.  The (Spur) VM bug is that the object was being filled with 0's instead of nil.  I've fixed the Spur VM to now fail for any non-indexable class since, AFAICT, DirectoryEntry is no longer used in this way.

_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: Shouldn't new:0 fail for non-indexable classes

Nicolai Hess-3-2


2017-08-09 22:14 GMT+02:00 Eliot Miranda <[hidden email]>:
Hi Nicolai,

On Tue, Aug 8, 2017 at 12:10 PM, Nicolai Hess <[hidden email]> wrote:
Create a class with a single instance variable.

call

AClass new:0

-> segfaults (on windows latest vm).
I can reproduce this on squeak (Squeak5.1-16549-32bit). It does not crash right away, but
I was able to crash it by debugging into the new: call.

from the comment of Behavior>>#new: , I would expect the error:

self error: self printString, ' cannot have variable sized instances'

Quite right.  Squeak and Pharo used to have a funky class DirectoryEntry that was expected to be able to be instantiated with DirectoryEntry new: 0.  The (Spur) VM bug is that the object was being filled with 0's instead of nil.  I've fixed the Spur VM to now fail for any non-indexable class since, AFAICT, DirectoryEntry is no longer used in this way.

Thank you!
 

_,,,^..^,,,_
best, Eliot