What steps will reproduce the problem?
1. Just compile and run:
import os
print os.listdir('/does/not/exist')
It should crash (Segmentation Fault). Instead, an OSError should be raised.
This happens with the last released version (0.9) and with the last git version
(tested on GNU/Linux only).
The problem seems to be that in the C++ builtin os.listdir, the result of the
call to opendir is not checked against 0 (0 is returned if the directory cannot
be read). When 0 is returned, it is given to readdir which segfaults.
I attach a simple patch that fix this bug: check the result of opendir and
raise an OSError if needed.
Original issue reported on code.google.com by pmdom...@gmail.com on 8 Dec 2011 at 10:42
Original issue reported on code.google.com by
pmdom...@gmail.com
on 8 Dec 2011 at 10:42Attachments: