Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#2522 Ttk depends on ckalloc(0) being non-NULL.

obsolete: 8.6a4

When testing Tk with the cvs HEAD using Electric Fence I found that Ttk is calling ckalloc(0) on startup of wish8.6, without any widgets created. It's just a simple wish8.6 exec.

(gdb) where
#0 0xb7f2e410 in __kernel_vsyscall ()
#1 0xb797f4b6 in kill () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7f19c54 in EF_Abort () from /usr/lib/libefence.so.0
#3 0xb7f1971b in memalign () from /usr/lib/libefence.so.0
#4 0xb7f1988b in malloc () from /usr/lib/libefence.so.0
#5 0xb7c9fec1 in TclpAlloc (numBytes=0) at /home/george/cvs/anon/tcl/unix/../generic/tclAlloc.c:706
#6 0xb7cafc91 in Tcl_Alloc (size=0) at /home/george/cvs/anon/tcl/unix/../generic/tclCkalloc.c:1019
#7 0xb7ec5556 in NewElementImpl (name=0xb4fa8ffc "", specPtr=0xb7f1462c, clientData=0x0)
at /home/george/cvs/anon/tk/unix/../generic/ttk/ttkTheme.c:247
#8 0xb7ec650e in Ttk_RegisterElement (interp=0xb789bcd0, theme=0xb4fa2f7c, name=0xb4fa8ffc "",
specPtr=0xb7f1462c, clientData=0x0)
at /home/george/cvs/anon/tk/unix/../generic/ttk/ttkTheme.c:906
#9 0xb7ec7ea1 in Ttk_StylePkgInit (interp=0xb789bcd0)
at /home/george/cvs/anon/tk/unix/../generic/ttk/ttkTheme.c:1728
#10 0xb7eb8612 in Ttk_Init (interp=0xb789bcd0)
at /home/george/cvs/anon/tk/unix/../generic/ttk/ttkInit.c:271
#11 0xb7e22b15 in Initialize (interp=0xb789bcd0)
at /home/george/cvs/anon/tk/unix/../generic/tkWindow.c:3207
#12 0xb7e22127 in Tk_Init (interp=0xb789bcd0)
at /home/george/cvs/anon/tk/unix/../generic/tkWindow.c:2846
#13 0x0804883e in Tcl_AppInit (interp=0xb789bcd0)
at /home/george/cvs/anon/tk/unix/../unix/tkAppInit.c:98
#14 0xb7e0dd8c in Tk_MainEx (argc=-1, argv=0xbfae0108, appInitProc=0x8048808 <Tcl_AppInit>,
interp=0xb789bcd0) at /home/george/cvs/anon/tk/unix/../generic/tkMain.c:258
#15 0x080487f8 in main (argc=1, argv=0xbfae0104)
at /home/george/cvs/anon/tk/unix/../unix/tkAppInit.c:68

(gdb) frame 7
#7 0xb7ec5556 in NewElementImpl (name=0xb4fa8ffc "", specPtr=0xb7f1462c, clientData=0x0)
at /home/george/cvs/anon/tk/unix/../generic/ttk/ttkTheme.c:247
(gdb) print elementImpl->nResources
$1 = 0

elementImpl->defaultValues = (Tcl_Obj**)
ckalloc(elementImpl->nResources * sizeof(Tcl_Obj *));

This seems like it will require some sort of fix throughout the ttkTheme.c, or the requirement of providing nResources > 0.


    • priority: 5 --> 9
    • status: open --> open-fixed
  • Fixed in HEAD by adding 1 to the size of those allocations.

    • assigned_to: jenglish --> dkf
    • status: open-fixed --> closed-fixed
  • Fixed in 8.5 branch