summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclCmdIL.c16
-rw-r--r--tests/lsearch.test11
3 files changed, 30 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3020402..9ccb792 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-05 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Prevent shimmering crash
+ when -exact and -integer/-real are mixed. [Bug 1844789]
+
2007-12-03 Donal K. Fellows <dkf@users.sf.net>
* unix/tclUnixChan.c (CreateSocketAddress): Add extra #ifdef-fery to
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 8d05eba..60ebf29 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdIL.c,v 1.127 2007/11/21 14:30:31 dkf Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.128 2007/12/05 13:42:09 dkf Exp $
*/
#include "tclInt.h"
@@ -2993,6 +2993,13 @@ Tcl_LsearchObjCmd(
}
return result;
}
+
+ /*
+ * List representation might have been shimmered; restore it. [Bug
+ * 1844789]
+ */
+
+ TclListObjGetElements(NULL, objv[objc - 2], &listc, &listv);
break;
case REAL:
result = Tcl_GetDoubleFromObj(interp, patObj, &patDouble);
@@ -3002,6 +3009,13 @@ Tcl_LsearchObjCmd(
}
return result;
}
+
+ /*
+ * List representation might have been shimmered; restore it. [Bug
+ * 1844789]
+ */
+
+ TclListObjGetElements(NULL, objv[objc - 2], &listc, &listv);
break;
}
} else {
diff --git a/tests/lsearch.test b/tests/lsearch.test
index fcaa85b..fed6bbd 100644
--- a/tests/lsearch.test
+++ b/tests/lsearch.test
@@ -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: lsearch.test,v 1.18 2005/12/09 14:13:01 dkf Exp $
+# RCS: @(#) $Id: lsearch.test,v 1.19 2007/12/05 13:42:09 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -463,6 +463,15 @@ test lsearch-20.3 {lsearch -index option, malformed index} {
list [catch {lsearch -index \{ {{a c} {a b} {a a}} a} msg] $msg
} {1 {unmatched open brace in list}}
+test lsearch-21.1 {lsearch shimmering crash} {
+ set x 0
+ lsearch -exact -integer $x $x
+} 0
+test lsearch-21.2 {lsearch shimmering crash} {
+ set x 0.5
+ lsearch -exact -real $x $x
+} 0
+
# cleanup
catch {unset res}
catch {unset increasingIntegers}