Package: python3-wand
Version: stable (jessie)
Severity: important

Dear Maintainer,

Using python3-wand python module in python script leads to crash of the 
interpreter (otherwise python3.4 is working fine).
The program crashes with message:
*** Error in `/usr/bin/python3.4': double free or corruption (!prev): 
0x085048b8 ***

Stack trace:

www-data@minlexx:~/default/xnova5$ gdb --args /usr/bin/python3.4 img_gen.py
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python3.4...Reading symbols from 
/usr/lib/debug//usr/bin/python3.4m...done.
done.
(gdb) r
Starting program: /usr/bin/python3.4 img_gen.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library 
"/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
[New Thread 0xb6990b40 (LWP 13061)]
*** Error in `/usr/bin/python3.4': double free or corruption (!prev): 
0x085048b8 ***

Program received signal SIGABRT, Aborted.
0xb7fdcd40 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fdcd40 in __kernel_vsyscall ()
#1  0xb7d83367 in __GI_raise (sig=sig@entry=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#2  0xb7d84a23 in __GI_abort () at abort.c:89
#3  0xb7dc1778 in __libc_message (do_abort=do_abort@entry=1, 
fmt=fmt@entry=0xb7eb9bdc "*** Error in `%s': %s: 0x%s ***\n") at 
../sysdeps/posix/libc_fatal.c:175
#4  0xb7dc77ea in malloc_printerr (action=<optimized out>, str=0xb7eb9cd0 
"double free or corruption (!prev)", ptr=0x85048b8) at malloc.c:4996
#5  0xb7dc843d in _int_free (av=0xb7efe420 <main_arena>, p=<optimized out>, 
have_lock=0) at malloc.c:3840
#6  0xb7a053bd in PyCData_clear (self=0xb7a68c44) at 
/build/python3.4-1IyEHS/python3.4-3.4.2/Modules/_ctypes/_ctypes.c:2469
#7  PyCData_dealloc.lto_priv.23 () at 
/build/python3.4-1IyEHS/python3.4-3.4.2/Modules/_ctypes/_ctypes.c:2478
#8  0x081522f6 in subtype_dealloc.lto_priv () at ../Objects/typeobject.c:1172
#9  0x08152479 in clear_slots (self=<optimized out>, type=<optimized out>) at 
../Objects/typeobject.c:990
#10 subtype_dealloc.lto_priv () at ../Objects/typeobject.c:1146
#11 0x08128b65 in free_keys_object.lto_priv.1165 (keys=keys@entry=0x85cd8c8) at 
../Objects/dictobject.c:369
#12 0x08128984 in dict_dealloc.lto_priv.155 (mp=0xb6af8d4c) at 
../Objects/dictobject.c:1391
#13 0x08132ffe in do_call (nk=<optimized out>, na=<optimized out>, 
pp_stack=<optimized out>, func=<optimized out>) at ../Python/ceval.c:4466
#14 call_function (oparg=<optimized out>, pp_stack=<optimized out>) at 
../Python/ceval.c:4261
#15 PyEval_EvalFrameEx () at ../Python/ceval.c:2836
#16 0x0812d004 in PyEval_EvalCodeEx () at ../Python/ceval.c:3585
#17 0x081b6c81 in PyEval_EvalCode (
    locals={'__loader__': <SourceFileLoader(name='__main__', path='img_gen.py') 
at remote 0xb7ab16cc>, '__name__': '__main__', '__builtins__': <module at 
remote 0xb7b35cfc>, '__package__': None, 'sqlite3': <module at remote 
0xb6b027ac>, '__doc__': None, 'db_filename': 'galaxy5.db', '__file__': 
'img_gen.py', 'output_filename': 'galaxy_map.png', '__cached__': None, 'wand': 
<module at remote 0xb7a79b94>, '__spec__': None},
    globals={'__loader__': <SourceFileLoader(name='__main__', 
path='img_gen.py') at remote 0xb7ab16cc>, '__name__': '__main__', 
'__builtins__': <module at remote 0xb7b35cfc>, '__package__': None, 'sqlite3': 
<module at remote 0xb6b027ac>, '__doc__': None, 'db_filename': 'galaxy5.db', 
'__file__': 'img_gen.py', 'output_filename': 'galaxy_map.png', '__cached__': 
None, 'wand': <module at remote 0xb7a79b94>, '__spec__': None}, co=<code at 
remote 0xb7aae7a0>) at ../Python/ceval.c:773
#18 run_mod.lto_priv () at ../Python/pythonrun.c:2180
#19 0x081ca720 in PyRun_FileExFlags () at ../Python/pythonrun.c:2133
#20 0x081c9980 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:1606
#21 0x0810df78 in run_file (p_cf=<optimized out>, filename=<optimized out>, 
fp=<optimized out>) at ../Modules/main.c:319
#22 Py_Main () at ../Modules/main.c:751
#23 0x0810d401 in main () at ../Modules/python.c:69
#24 0xb7d6ea63 in __libc_start_main (main=0x810d320 <main>, argc=2, 
argv=0xbffffcc4, init=0x828d520 <__libc_csu_init>, fini=0x828d590 
<__libc_csu_fini>,
    rtld_fini=0xb7fedc50 <_dl_fini>, stack_end=0xbffffcbc) at libc-start.c:287
#25 0x0810d24a in _start ()
-------------------------------------


img_gen.py contents:
-------------------------------------

#!/usr/bin/python3

# Uses imagemagick to draw galaxy stats as png file

import wand
import wand.image
import wand.color
import wand.drawing
import sqlite3

output_filename = 'galaxy_map.png'
db_filename = 'galaxy5.db'

img = wand.image.Image(width=499, height=10, 
background=wand.color.Color('#fff'))
dr = wand.drawing.Drawing()
sqconn = sqlite3.connect(db_filename)

dr.clear()
for x in range(0, 499):
    for y in range(0, 4):
        q = 'SELECT COUNT(*) FROM planets WHERE s=? AND g=?'
        cur = sqconn.cursor()
        cur.execute(q, (x+1, y+1))
        row = cur.fetchone()
        num_planets = row[0]
        fill_percent = num_planets / 15
        cc = int(255 * fill_percent)
        col = wand.color.Color('rgb({0},{1},{2})'.format(cc,cc,cc))
        dr.fill_color = col
        dr.point(x, y)

dr.draw(img)
img.save(filename=output_filename)

----------------------------------------

-- System Information:
Debian Release: 8.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to