summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2014-12-03 23:05:15 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2014-12-03 23:05:15 (GMT)
commit9e5f0ade58641b9719e70838d98e562c867193dd (patch)
tree9e53471e3f1bca4b296a17428b0908bba2a71c63 /generic
parenta03c9da848ffd7e60101c43321e05f79635f8cef (diff)
downloadtcl-9e5f0ade58641b9719e70838d98e562c867193dd.zip
tcl-9e5f0ade58641b9719e70838d98e562c867193dd.tar.gz
tcl-9e5f0ade58641b9719e70838d98e562c867193dd.tar.bz2
[0dca3bfa8f] Strengthen validity checks on fast-path string comparison.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 337a75f..b9da8fc 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -5410,8 +5410,8 @@ TEBCresume(
s1 = (char *) Tcl_GetByteArrayFromObj(valuePtr, &s1len);
s2 = (char *) Tcl_GetByteArrayFromObj(value2Ptr, &s2len);
memCmpFn = memcmp;
- } else if (((valuePtr->typePtr == &tclStringType)
- && (value2Ptr->typePtr == &tclStringType))) {
+ } else if ((valuePtr->typePtr == &tclStringType)
+ && (value2Ptr->typePtr == &tclStringType)) {
/*
* Do a unicode-specific comparison if both of the args are of
* String type. If the char length == byte length, we can do a
@@ -5422,7 +5422,9 @@ TEBCresume(
s1len = Tcl_GetCharLength(valuePtr);
s2len = Tcl_GetCharLength(value2Ptr);
if ((s1len == valuePtr->length)
- && (s2len == value2Ptr->length)) {
+ && (valuePtr->bytes != NULL)
+ && (s2len == value2Ptr->length)
+ && (value2Ptr->bytes != NULL)) {
s1 = valuePtr->bytes;
s2 = value2Ptr->bytes;
memCmpFn = memcmp;