From 73e618c2bec30116d7b413e8776a74a8fbf4427d Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sun, 12 Oct 2008 19:53:32 +0000 Subject: * generic/tclCompile.c: fix bug in srcDelta encoding within ByteCodes. The bug can only be triggered under conditions that cannot happen in Tcl, but were met during development of L. Thanks go to Robert Netzer for diagnose and fix. --- ChangeLog | 7 +++++++ generic/tclCompile.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab147f9..2bab9cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-10-12 Miguel Sofer + + * generic/tclCompile.c: fix bug in srcDelta encoding within + ByteCodes. The bug can only be triggered under conditions that + cannot happen in Tcl, but were met during development of L. Thanks + go to Robert Netzer for diagnose and fix. + 2008-10-10 Don Porter *** 8.6a3 TAGGED FOR RELEASE *** diff --git a/generic/tclCompile.c b/generic/tclCompile.c index c55258f..b347018 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.157 2008/10/05 20:47:52 nijtmans Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.158 2008/10/12 19:53:32 msofer Exp $ */ #include "tclInt.h" @@ -3177,7 +3177,7 @@ GetCmdLocEncodingSize( } srcDelta = (mapPtr[i].srcOffset - prevSrcOffset); - if ((-127 <= srcDelta) && (srcDelta <= 127)) { + if ((-127 <= srcDelta) && (srcDelta <= 127) && (srcDelta != -1)) { srcDeltaNext++; } else { srcDeltaNext += 5; /* 1 byte for 0xFF, 4 for delta */ @@ -3285,7 +3285,7 @@ EncodeCmdLocMap( prevOffset = 0; for (i = 0; i < numCmds; i++) { srcDelta = (mapPtr[i].srcOffset - prevOffset); - if ((-127 <= srcDelta) && (srcDelta <= 127)) { + if ((-127 <= srcDelta) && (srcDelta <= 127) && (srcDelta != -1)) { TclStoreInt1AtPtr(srcDelta, p); p++; } else { -- cgit v0.12