[Image-SIG] Seg Fault using PIL, Palette problem?

Daniel Kahn daniel_kahn at ssaihq.com
Thu Apr 17 18:37:13 CEST 2008


Greetings,

I have a program which is producing a segmentation fault.  I will attach 
the source code to reproduce the problem.  The code is from a larger 
program which I have paired down considerably to help isolate the problem. 

The stack trace from GDB is below.  The crash occured in a PIL function, 
relating to Palette destruction.

I am running under CentOS (which is supposed to be identical to Red Hat, 
as I understand).

Here is the python information (however the crash has occured on 2.3.4 
and 2.5.1 as well).

$ ~/bin/python
Python 2.5.2 (r252:60911, Apr 15 2008, 17:53:34)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2

I am using PIL 1.1.6.

The code requires an image to work.  I have used the image lena.gif 
which I have not included here, but is widely available on the web.  I 
expect the problem will occur with any image.

The first line (#!/home/dkahn/bin/python) directs program to use the 
version of python I installed in my home directory.  You will need to 
change this to get the correct one for you system.

Thanks for any help in fixing this problem.
Cheers,
--dan

Backtrace:

(gdb) where
#0  0x009c28f9 in free () from /lib/tls/libc.so.6
#1  0x005e6f49 in ImagingPaletteDelete (palette=0x85234d0) at 
libImaging/Palette.c:126
#2  0x005ed8fd in ImagingDelete (im=0x84aec78) at libImaging/Storage.c:243
#3  0x005cbe33 in _dealloc (imagep=0xb7f570f0) at _imaging.c:201
#4  0x08082ebc in dict_dealloc (mp=0xff) at Objects/dictobject.c:851
#5  0x080612c9 in instance_dealloc (inst=0xb7f9034c) at 
Objects/classobject.c:660
#6  0x081093ea in frame_dealloc (f=0x84a6de4) at Objects/frameobject.c:416
#7  0x080c40a9 in PyEval_EvalCodeEx (co=0xb7f5d608, globals=0xb7faeacc, 
locals=0x0, args=0xb7f6bcd8, argcount=1, kws=0x0, kwcount=0, 
defs=0xb7f6c1a0, defcount=4, closure=0x0)
    at Python/ceval.c:2847
#8  0x0810ae36 in function_call (func=0xb7f1509c, arg=0xb7f6bccc, 
kw=0x0) at Objects/funcobject.c:517
#9  0x0805d958 in PyObject_Call (func=0xf7, arg=0xb7f6bccc, kw=0x0) at 
Objects/abstract.c:1861
#10 0x0806696d in instancemethod_call (func=0xb7f551bc, arg=0xb7f6bccc, 
kw=0x0) at Objects/classobject.c:2519
#11 0x0805d958 in PyObject_Call (func=0xf7, arg=0xb7f9602c, kw=0x0) at 
Objects/abstract.c:1861
#12 0x080bce13 in PyEval_CallObjectWithKeywords (func=0xb7f551bc, 
arg=0xb7f9602c, kw=0x0) at Python/ceval.c:3442
#13 0x08060dbc in PyInstance_New (klass=0xb7f60f5c, arg=0xb7f9602c, 
kw=0x0) at Objects/classobject.c:560
#14 0x0805d958 in PyObject_Call (func=0xf7, arg=0xb7f9602c, kw=0x0) at 
Objects/abstract.c:1861
#15 0x080bf564 in PyEval_EvalFrameEx (f=0x847b01c, throwflag=0) at 
Python/ceval.c:3784
#16 0x080c411b in PyEval_EvalCodeEx (co=0xb7f5db18, globals=0xb7faeacc, 
locals=0xb7faeacc, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at Python/ceval.c:2836
#17 0x080c426a in PyEval_EvalCode (co=0xb7f5db18, globals=0xb7faeacc, 
locals=0xb7faeacc) at Python/ceval.c:494
#18 0x080e2a8d in PyRun_FileExFlags (fp=0x8469008, filename=0xbff8b407 
"CreateSampleTable.py", start=257, globals=0xb7faeacc, 
locals=0xb7faeacc, closeit=1, flags=0xbff161cc)
    at Python/pythonrun.c:1273
#19 0x080e3712 in PyRun_SimpleFileExFlags (fp=0x8469008, 
filename=0xbff8b407 "CreateSampleTable.py", closeit=1, flags=0xbff161cc) 
at Python/pythonrun.c:879
#20 0x08056d59 in Py_Main (argc=1, argv=0xbff16304) at Modules/main.c:523
#21 0x080562f7 in main (argc=2, argv=0xbff16304) at ./Modules/python.c:23


-- 
Daniel Kahn
Science Systems and Applications Inc.
301-867-2162

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CreateSampleTable.py
Type: application/x-python
Size: 1080 bytes
Desc: not available
Url : http://mail.python.org/pipermail/image-sig/attachments/20080417/7881659f/attachment.bin 


More information about the Image-SIG mailing list