diff options
author | dgp <dgp@users.sourceforge.net> | 2016-06-22 18:57:07 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-06-22 18:57:07 (GMT) |
commit | 9782b57e718a22de621fb4b222b4509922e77a08 (patch) | |
tree | 25bd1daac461615252314bf899c7358f52bf14d7 /generic/tclUtil.c | |
parent | 5f37ca27b1c063da4d683acdadc4ac1e458fa543 (diff) | |
parent | a584299193791f22e2e29fefceec030584feae54 (diff) | |
download | tcl-9782b57e718a22de621fb4b222b4509922e77a08.zip tcl-9782b57e718a22de621fb4b222b4509922e77a08.tar.gz tcl-9782b57e718a22de621fb4b222b4509922e77a08.tar.bz2 |
merge 8.6
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 2b0fb72..553593c 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2634,7 +2634,19 @@ Tcl_DStringAppend( memcpy(newString, dsPtr->string, (size_t) dsPtr->length); dsPtr->string = newString; } else { + int offset = -1; + + /* See [16896d49fd] */ + if (bytes >= dsPtr->string + && bytes <= dsPtr->string + dsPtr->length) { + offset = bytes - dsPtr->string; + } + dsPtr->string = ckrealloc(dsPtr->string, dsPtr->spaceAvl); + + if (offset >= 0) { + bytes = dsPtr->string + offset; + } } } @@ -2725,7 +2737,19 @@ Tcl_DStringAppendElement( memcpy(newString, dsPtr->string, (size_t) dsPtr->length); dsPtr->string = newString; } else { + int offset = -1; + + /* See [16896d49fd] */ + if (element >= dsPtr->string + && element <= dsPtr->string + dsPtr->length) { + offset = element - dsPtr->string; + } + dsPtr->string = ckrealloc(dsPtr->string, dsPtr->spaceAvl); + + if (offset >= 0) { + element = dsPtr->string + offset; + } } dst = dsPtr->string + dsPtr->length; } |