[Python-modules-team] Bug#554425: infinite loop on corrupted file

Emile Anclin emile.anclin at logilab.fr
Wed Nov 4 14:27:43 UTC 2009


Package: python-numpy
Version : 1:1.1.0-3+lenny1

When using "numpy.fromfile" on a corrupted file, numpy runs
into an infinite loop with memory lack.


$  dpkg -s libc6 | grep ^Version
Version: 2.7-18

$ uname -r
2.6.29-2-amd64

$ cat corrupted.txt
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0,7
0,7
0.0
0.0
0.0
0.0
0.0
0.0

$ python
Python 2.5.2 (r252:60911, Jan  4 2009, 21:59:32) 
[GCC 4.3.2] on linux2

>>> import numpy
>>> f = open('corrupted.txt')
>>> data = numpy.fromfile(f, dtype=float, count=-1, sep='\t')

The infinite loop can not be interrupted with "^C". One has to kill the 
python process.

Note that in 'corrupted.txt' there is a '0,7' around line 10 while the 
rest are only '0.0'.

This problem can not be reproduced on Version : 1:1.2.1-1.1

-- 

Emile Anclin <emile.anclin at logilab.fr>
http://www.logilab.fr/   http://www.logilab.org/ 
Informatique scientifique & et gestion de connaissances





More information about the Python-modules-team mailing list