[Scipy-tickets] [SciPy] #1205: Converting PIL image to Scipy crashes Python

SciPy Trac scipy-tickets@scipy....
Fri Jun 18 04:39:01 CDT 2010


#1205: Converting PIL image to Scipy crashes Python
--------------------+-------------------------------------------------------
 Reporter:  jpa     |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  0.8.0   
Component:  Other   |     Version:  0.7.0   
 Keywords:          |  
--------------------+-------------------------------------------------------
 This bug was originally filed here:
 https://bugzilla.redhat.com/show_bug.cgi?id=603818

 ----

 Attached is a simple file that segfaults Python when it is read with PIL
 and then converted to a Scipy array.

 Here's a log of an interactive session that shows you how to replicate the
 bug.

 {{{
 localhost 18:28 0 > python

 Python 2.6.4 (r264:75706, Apr  1 2010, 02:56:02)
 [GCC 4.4.3 20100226 (Red Hat 4.4.3-8)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.

 >>> import Image, scipy
 >>> image = Image.open('scipy_crash.png')
 >>> arr = scipy.asarray(image)
 >>> arr
 zsh: segmentation fault (core dumped)  python
 }}}

 Other images of the same type survive the last command. You can crash them
 by continuing with e.g. these commands:
 {{{
 from scipy import fftpack
 x = fftpack.fft2(arr)
 }}}
 The probable reason for this crash is that the image is a PNG bitmap. When
 it is converted to a Scipy array the result is a Scipy array of booleans,
 not numbers. Somehow this causes a crash.

 ----

 This happens on Fedora 13. Here is the backtrace:

 {{{
 #0  0x00b962aa in __memcpy_ia32 () from /lib/libc.so.6

 #1  0x003911dd in ?? ()
    from /usr/lib/python2.6/site-packages/numpy/core/multiarray.so

 #2  0x00392f5e in ?? ()
    from /usr/lib/python2.6/site-packages/numpy/core/multiarray.so

 #3  0x0038b171 in ?? ()
    from /usr/lib/python2.6/site-packages/numpy/core/multiarray.so

 #4  0x003a4bb0 in ?? ()
    from /usr/lib/python2.6/site-packages/numpy/core/multiarray.so

 #5  0x003a503d in ?? ()
    from /usr/lib/python2.6/site-packages/numpy/core/multiarray.so

 #6  0x003a5472 in ?? ()
    from /usr/lib/python2.6/site-packages/numpy/core/multiarray.so

 #7  0x001ec7c8 in PyCFunction_Call () from /usr/lib/libpython2.6.so.1.0

 #8  0x0024959d in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0

 #9  0x0024a100 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0

 #10 0x0024a100 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0

 #11 0x0024affc in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0

 #12 0x0024918a in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0

 #13 0x0024affc in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0

 #14 0x0024918a in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0

 #15 0x0024affc in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0

 #16 0x001d8858 in ?? () from /usr/lib/libpython2.6.so.1.0

 #17 0x001abadd in PyObject_Call () from /usr/lib/libpython2.6.so.1.0

 #18 0x002441e5 in PyEval_CallObjectWithKeywords ()
    from /usr/lib/libpython2.6.so.1.0

 #19 0x0037e55f in ?? ()
    from /usr/lib/python2.6/site-packages/numpy/core/multiarray.so

 #20 0x001f034d in PyObject_Repr () from /usr/lib/libpython2.6.so.1.0

 #21 0x001f0998 in ?? () from /usr/lib/libpython2.6.so.1.0

 #22 0x001d1479 in PyFile_WriteObject () from /usr/lib/libpython2.6.so.1.0

 #23 0x0026d6d3 in ?? () from /usr/lib/libpython2.6.so.1.0

 #24 0x001ec725 in PyCFunction_Call () from /usr/lib/libpython2.6.so.1.0

 #25 0x001abadd in PyObject_Call () from /usr/lib/libpython2.6.so.1.0

 #26 0x002441e5 in PyEval_CallObjectWithKeywords ()
    from /usr/lib/libpython2.6.so.1.0

 #27 0x00248d66 in PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0

 #28 0x0024affc in PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0

 #29 0x0024b124 in PyEval_EvalCode () from /usr/lib/libpython2.6.so.1.0

 #30 0x0026633c in ?? () from /usr/lib/libpython2.6.so.1.0

 #31 0x00267ea7 in PyRun_InteractiveOneFlags ()
    from /usr/lib/libpython2.6.so.1.0

 #32 0x002680c3 in PyRun_InteractiveLoopFlags ()
    from /usr/lib/libpython2.6.so.1.0

 #33 0x0026820f in PyRun_AnyFileExFlags () from
 /usr/lib/libpython2.6.so.1.0

 #34 0x00274add in Py_Main () from /usr/lib/libpython2.6.so.1.0

 #35 0x080485c8 in main ()
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1205>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list