Subject: Stop buffer overrun into undefined values detected by valgrind.

From: dgp <[email-masked]>
Date: Wed, 26 Jun 2013 20:13:57 +0000

---
 generic/tclOptimize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;
 	    }
-- 
cgit v0.12