summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-09-19 04:20:53 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-09-19 04:20:53 (GMT)
commit6ad8909af3c178fac395992cd972c98270bf2e3c (patch)
tree8287ff5f0602550d1a6852d95a8aa7265acc3af8
parenta57f75c197b1d3371c96802a894b9a85d84f2632 (diff)
downloadtcl-6ad8909af3c178fac395992cd972c98270bf2e3c.zip
tcl-6ad8909af3c178fac395992cd972c98270bf2e3c.tar.gz
tcl-6ad8909af3c178fac395992cd972c98270bf2e3c.tar.bz2
Stop segfault due to OBOE in CompileWord() calls in [dict lappend] compiler.
-rw-r--r--generic/tclCompCmds.c4
-rw-r--r--tests/dict.test6
2 files changed, 8 insertions, 2 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index f96470d..fa4762d 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -1313,8 +1313,8 @@ TclCompileDictLappendCmd(
return TCL_ERROR;
}
dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr);
- CompileWord(envPtr, keyTokenPtr, interp, 3);
- CompileWord(envPtr, valueTokenPtr, interp, 4);
+ CompileWord(envPtr, keyTokenPtr, interp, 2);
+ CompileWord(envPtr, valueTokenPtr, interp, 3);
TclEmitInstInt4( INST_DICT_LAPPEND, dictVarIndex, envPtr);
return TCL_OK;
}
diff --git a/tests/dict.test b/tests/dict.test
index a673957..6271779 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -1243,6 +1243,12 @@ j
}
}} [linenumber]
} 5
+test dict-23.3 {CompileWord OBOE} {
+ # segfault when buggy
+ apply {{} {tcl::dict::lappend foo bar \
+ [format baz]}}
+} {bar baz}
+
rename linenumber {}
# cleanup