Tk Source Code

View Ticket
Login
Ticket UUID: 7c49a7f594c8d47dfdf7b6037b8316e4d51cc36a
Title: TIP #166 - Crashes during test suite run on Win
Type: Bug Version: tip-166
Submitter: fvogel Created on: 2017-03-28 06:16:08
Subsystem: 41. Photo Images Assigned To: simonbachmann
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-04-05 04:03:11
Resolution: Fixed Closed By: fvogel
    Closed on: 2017-04-05 04:03:11
Description:

Tests imgListFormat-3.5 and imagePhoto-4.98 crash on Windows.

This can be reproduced simply by:

For imgListFormat-3.5:

% package require Tk
8.7a0
% image create photo photo1
photo1
% photo1 put {{blue green}
     {yellow magenta}
     {#000000 #FFFFFFFF}}
alloc: invalid block: 02CE5848: ef ef 0

For imagePhoto-4.98:

% package require Tk
8.7a0
% image create photo photo1
photo1
% photo1 put {{"alice blue" "blanched almond"}
         {"deep sky blue" "ghost white"}
         {#AABBCC #AABBCCDD}} -to 5 6
alloc: invalid block: 026C57C8: ef ef 0

In both cases the call stack is:

 >    tcl87tg.dll!tclWinDebugPanic(const char * format=0x1020ce18, 
...)  Line 832    C
      tcl87tg.dll!Tcl_PanicVA(const char * format=0x1020ce18, char * 
argList=0x002bf870)  Line 104    C
      tcl87tg.dll!Tcl_Panic(const char * format=0x1020ce18, ...) Line 
161    C
      tcl87tg.dll!Ptr2Block(char * ptr=0x042c7718)  Line 843    C
      tcl87tg.dll!TclpFree(char * ptr=0x042c7718)  Line 399 + 0x9 
bytes    C
      tcl87tg.dll!Tcl_Free(char * ptr=0x042c7718)  Line 1221 + 0x9 
bytes    C
      tk87tg.dll!StringReadDef(Tcl_Interp * interp=0x00695bd0, Tcl_Obj 
* data=0x042cbed0, Tcl_Obj * formatString=0x00000000, void * 
imageHandle=0x0428e368, int destX=5, int destY=6, int width=2, int 
height=3, int srcX=0, int srcY=0)  Line 573 + 0x14 bytes    C
      tk87tg.dll!ImgPhotoCmd(void * clientData=0x0428e368, Tcl_Interp 
* interp=0x00695bd0, int objc=6, Tcl_Obj * const * objv=0x0069cf34)  
Line 901 + 0x3d bytes    C
      tcl87tg.dll!Dispatch(void * * data=0x042ccce4, Tcl_Interp * 
interp=0x00695bd0, int result=0)  Line 4376 + 0x15 bytes    C
      tcl87tg.dll!TclNRRunCallbacks(Tcl_Interp * interp=0x00695bd0, 
int result=0, NRE_callback * rootPtr=0x00000000)  Line 4409 + 0x14 
bytes    C
      tcl87tg.dll!TclEvalObjEx(Tcl_Interp * interp=0x00695bd0, Tcl_Obj 
* objPtr=0x00748618, int flags=131072, const CmdFrame * 
invoker=0x00000000, int word=0)  Line 5976 + 0x11 bytes    C
      tcl87tg.dll!Tcl_EvalObjEx(Tcl_Interp * interp=0x00695bd0, 
Tcl_Obj * objPtr=0x00748618, int flags=131072)  Line 5957 + 0x15 
bytes    C
      tcl87tg.dll!Tcl_RecordAndEvalObj(Tcl_Interp * interp=0x00695bd0, 
Tcl_Obj * cmdPtr=0x00748618, int flags=131072) Line 189 + 0x17 bytes    C
      tcl87tg.dll!StdinProc(void * clientData=0x002bfecc, int mask=2)  
Line 811 + 0x12 bytes    C
      tcl87tg.dll!Tcl_NotifyChannel(Tcl_Channel_ * channel=0x006cb508, 
int mask=2)  Line 8319 + 0x1b bytes    C
      tcl87tg.dll!ConsoleEventProc(Tcl_Event * evPtr=0x03045c30, int 
flags=-3)  Line 964 + 0x16 bytes    C
      tcl87tg.dll!Tcl_ServiceEvent(int flags=-3)  Line 670 + 0xd 
bytes    C
      tcl87tg.dll!Tcl_DoOneEvent(int flags=-3)  Line 967 + 0x9 bytes    C
      tk87tg.dll!Tk_MainLoop()  Line 2148 + 0x11 bytes    C
      tcl87tg.dll!Tcl_MainExW(int argc=-1, unsigned short * * 
argv=0x02831bec, int (Tcl_Interp *)* appInitProc=0x004010a0, 
Tcl_Interp * interp=0x00695bd0)  Line 580 + 0x5 bytes    C
      tclsh87tg.exe!wmain(int argc=1, unsigned short * * 
argv=0x02831be8)  Line 129 + 0x25 bytes    C
      tclsh87tg.exe!__tmainCRTStartup()  Line 579 + 0x19 bytes    C
      tclsh87tg.exe!wmainCRTStartup()  Line 399    C

So the problem is triggered by execution of the line:

     ckfree(srcBlock.pixelPtr);

in tkImgListFormat.c:573

User Comments: fvogel added on 2017-04-05 04:03:11:

[4f9516ab] fixes this for me on Windows.


fvogel added on 2017-04-02 19:18:54:

MS Visual Express Edition 2008 on Vista.

This issue looks similar, if not identical, as [9983b847b7d734e21b4f3c047a04f5ce106a3130]. Problem is when running the [.image put] command in both cases.


simonbachmann (claiming to be Simon Bachmann) added on 2017-04-02 18:10:41:
Can't reproduce this (Windows 7, Visual studio community 2017): the test suite runs without crashes for me.

Could you provide details on your test environnement?