opensmalltalk-vm icon indicating copy to clipboard operation
opensmalltalk-vm copied to clipboard

primitiveDirectoryLookup NULL access on Windows

Open johenning opened this issue 6 years ago • 0 comments

The following code crashes the VM:

i:=0.
[ FileDirectory new primLookupEntryIn: 'C:' index: i] whileNotNil: [ i:= i+1].
FileDirectory new primLookupEntryIn: 'C:' index: i+1

The reason is that the dirCacheHit path in sqWin32Directory.c is taken and FindNextFileW is called with findHandle == NULL.

Additionally, primLookupEntryIn accepts negative indices, which means this works but probably should not:

FileDirectory new primLookupEntryIn: 'C:' index: -1.
FileDirectory new primLookupEntryIn: 'C:' index: 0.
(FileDirectory new primLookupEntryIn: 'C:' index: 1) ~~(FileDirectory new primLookupEntryIn: 'C:' index: 1) "= true" 

johenning avatar Feb 19 '19 15:02 johenning