diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2014-04-30 21:24:39 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2014-04-30 21:24:39 (GMT) |
commit | 10d7a2ac566063ffdd10a932a0d610ae6ecd62dd (patch) | |
tree | 08c5eda3675c80490c1e1f9f7f25a90deaf7b3f0 /generic/tclExecute.c | |
parent | b648be8b339531ac4f5f2aadd42094bccaa7b758 (diff) | |
download | tcl-10d7a2ac566063ffdd10a932a0d610ae6ecd62dd.zip tcl-10d7a2ac566063ffdd10a932a0d610ae6ecd62dd.tar.gz tcl-10d7a2ac566063ffdd10a932a0d610ae6ecd62dd.tar.bz2 |
[82e7f67325] Fix an evil refcount problem in compiled [string replace].
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 2c136d7..4ecca5b 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5702,11 +5702,21 @@ TEBCresume( length - toIdx); } } else { - objResultPtr = value3Ptr; + /* + * Be careful with splicing the stack in this case; we have a + * refCount:1 object in value3Ptr and we want to append to it and + * make it be the refCount:1 object at the top of the stack + * afterwards. [Bug 82e7f67325] + */ + if (toIdx < length) { - Tcl_AppendUnicodeToObj(objResultPtr, ustring1 + toIdx + 1, + Tcl_AppendUnicodeToObj(value3Ptr, ustring1 + toIdx + 1, length - toIdx); } + TRACE_APPEND(("\"%.30s\"\n", O2S(value3Ptr))); + TclDecrRefCount(valuePtr); + OBJ_AT_TOS = value3Ptr; /* Tricky! */ + NEXT_INST_F(1, 0, 0); } TclDecrRefCount(value3Ptr); TRACE_APPEND(("\"%.30s\"\n", O2S(objResultPtr))); |