Tcl Source Code

View Ticket
Login
Ticket UUID: 558324
Title: Bad pointer ref with regexp, linked var
Type: Patch Version: None
Submitter: watsonrick Created on: 2002-05-20 15:46:34
Subsystem: 09. Linked C Variables Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2002-06-20 05:41:57
Resolution: Fixed Closed By: hobbs
    Closed on: 2002-06-19 22:41:57
Description:
The bug occurs when a regular expression evaluation 
updates a linked variable. In my case, tcp_plot_queue 
name is the linked variable and the regular expression 
is:

  regexp {(plot-[a-z]+)} [qr_dump_node $Process ]
               junk1 tcp_plot_queue_name

After the call in frame #5, interp->resultObjPtr has 
been replaced, so resultPtr is invalid.

gdb) where
#0  TclFreeObj (objPtr=0x9fc9a78) 
at ./../generic/tclObj.c:599
#1  0x081acebb in LinkTraceProc (clientData=0x83c8a80, 
interp=0x8378a68, name1=0x9f94150
"tcp_login_queue_name", name2=0x0, flags=32)
    at ./../generic/tclLink.c:370
#2  0x081c38f3 in CallTraces (iPtr=0x8378a68, 
arrayPtr=0x0, varPtr=0x84b1920,
part1=0x9f94150 "tcp_login_queue_name", part2=0x0, 
flags=32)
    at ./../generic/tclVar.c:4172
#3  0x081c179b in Tcl_SetVar2Ex (interp=0x8378a68, 
part1=0x9f94150 "tcp_login_queue_name",
part2=0x0, newValuePtr=0x83a81a8, flags=0)
    at ./../generic/tclVar.c:1340
#4  0x081c1404 in Tcl_ObjSetVar2 (interp=0x8378a68, 
part1Ptr=0x9fc9a30, part2Ptr=0x0,
newValuePtr=0x83a81a8, flags=0) at ./../generic/tclV\
ar.c:1142
#5  0x0818b262 in Tcl_RegexpObjCmd (dummy=0x0, 
interp=0x8378a68, objc=5, objv=0xbfffe80c)
at ./../generic/tclCmdMZ.c:366
#6  0x081b3754 in EvalObjv (interp=0x8378a68, objc=5, 
objv=0xbfffe800,
    command=0x9f9041e "#puts [qr_dump_node $Process]
\n\n### Testing new ipt\n#rick regexp
{(berp-[a-z0-9]+)} [qr_dump_node $Process ] junk\
2 tcp_login_queue_name\nregexp {(berp-[a-z0-9]+)} 
\"$realstuff\" junk2
tcp_login_queue_name"..., length=15455, flags=0) 
at ./../generic/tc\
lParse.c:932
#7  0x081b3d6a in Tcl_EvalEx (interp=0x8378a68,
    script=0x9f8fd90 "# from prod that crashes 
linux\nset Process [ config { set
NTK_ProcessName } ]\nregexp {([^-]+)-([^0-9]*)([0-9]
+)} $\
Process junk class cluster instance\nset Hostname [ 
config { set hostname } ]\n\n###
temp"..., numBytes=17133, flags=0) at ./../generic/tc\
lParse.c:1393
#8  0x081b4019 in Tcl_Eval (interp=0x8378a68,
    string=0x9f8fd90 "# from prod that crashes 
linux\nset Process [ config { set
NTK_ProcessName } ]\nregexp {([^-]+)-([^0-9]*)([0-9]
+)} $\
Process junk class cluster instance\nset Hostname [ 
config { set hostname } ]\n\n###
temp"...) at ./../generic/tclParse.c:1548
#9  0x08184327 in Tcl_GlobalEval (interp=0x8378a68,
    command=0x9f8fd90 "# from prod that crashes 
linux\nset Process [ config { set
NTK_ProcessName } ]\nregexp {([^-]+)-([^0-9]*)([0-9]
+)} \
$Process junk class cluster instance\nset Hostname [ 
config { set hostname } ]\n\n###
temp"...) at ./../generic/tclBasic.c:4149
#10 0x08109e76 in NTK_Exec_Tcl_Config_File (ti=0x0, 
file_name=0xbffffa40 "ipt_post.tcl",
is_mandatory=1, exit_on_error=1) at nt_kernel.c:8\
User Comments: hobbs added on 2002-06-20 05:41:57:
Logged In: YES 
user_id=72656

added to 8.4cvs on 2002-06-19

watsonrick added on 2002-05-20 22:46:34:

File Added - 23403: tclCmdMZ.c.patch

Attachments: