[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] primitiveDirectoryLookup NULL access on Windows (#372)

johenning notifications at github.com
Tue Feb 19 15:14:37 UTC 2019


The following code crashes the VM:
```smalltalk
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:
```smalltalk
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" 
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/372
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20190219/c98fca5e/attachment.html>


More information about the Vm-dev mailing list