summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-06-26 20:13:57 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-06-26 20:13:57 (GMT)
commitd8e108cc4748d02d928366cc07447b2e738e796b (patch)
tree15cf45d4cf45d83d1ce0d4aba51644f981f528a8
parentd586d955ce5e6ebbd9b670d848ef7c4f4935f9f3 (diff)
downloadtcl-d8e108cc4748d02d928366cc07447b2e738e796b.zip
tcl-d8e108cc4748d02d928366cc07447b2e738e796b.tar.gz
tcl-d8e108cc4748d02d928366cc07447b2e738e796b.tar.bz2
Stop buffer overrun into undefined values detected by valgrind.
-rw-r--r--generic/tclOptimize.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c
index cd37a6a..b7f4173 100644
--- a/generic/tclOptimize.c
+++ b/generic/tclOptimize.c
@@ -212,7 +212,8 @@ ConvertZeroEffectToNOP(
int blank = 0, i, nextInst;
size = AddrLength(currentInstPtr);
- while (*(currentInstPtr+size) == INST_NOP) {
+ while ((currentInstPtr + size < envPtr->codeNext)
+ && *(currentInstPtr+size) == INST_NOP) {
if (IsTargetAddress(&targets, currentInstPtr + size)) {
break;
}