summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2008-10-12 19:53:32 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2008-10-12 19:53:32 (GMT)
commit73e618c2bec30116d7b413e8776a74a8fbf4427d (patch)
treeb62984cea2140c3e91a68a973ef9f2bf1a49b090 /generic
parent5c0c022b7d9b60ca496702f7cb865df85456c948 (diff)
downloadtcl-73e618c2bec30116d7b413e8776a74a8fbf4427d.zip
tcl-73e618c2bec30116d7b413e8776a74a8fbf4427d.tar.gz
tcl-73e618c2bec30116d7b413e8776a74a8fbf4427d.tar.bz2
* 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.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompile.c6
1 files changed, 3 insertions, 3 deletions
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 {