summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authormsofer <msofer@noemail.net>2006-09-24 21:15:09 (GMT)
committermsofer <msofer@noemail.net>2006-09-24 21:15:09 (GMT)
commit2a69ce16e7c34d2669f174be9349868a34ba362b (patch)
tree52642af6e3fb2c29a09534224d480bb89536d396 /generic/tclStringObj.c
parentb2b9c5dbebc0ec6f42e43ec17bf8a2cc3cd9e609 (diff)
downloadtcl-2a69ce16e7c34d2669f174be9349868a34ba362b.zip
tcl-2a69ce16e7c34d2669f174be9349868a34ba362b.tar.gz
tcl-2a69ce16e7c34d2669f174be9349868a34ba362b.tar.bz2
* generic/tclParse.c (Tcl_ParseCommand): also return an error if
start==NULL and numBytes<0. This is coverity's bug #20 * generic/tclStringObj.c (STRING_SIZE): fix allocation for 0-length strings. This is coverity's bugs #54-5 FossilOrigin-Name: cbbabd2395ec80a8faa1b00c284951f29da82e61
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 9ec2f63..ab04253 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.32.2.1 2006/01/23 11:24:36 msofer Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.32.2.2 2006/09/24 21:15:11 msofer Exp $ */
#include "tclInt.h"
@@ -105,8 +105,10 @@ typedef struct String {
#define STRING_UALLOC(numChars) \
(numChars * sizeof(Tcl_UniChar))
-#define STRING_SIZE(ualloc) \
- ((unsigned) (sizeof(String) - sizeof(Tcl_UniChar) + ualloc))
+#define STRING_SIZE(ualloc) \
+ ((unsigned) ((ualloc) \
+ ? sizeof(String) - sizeof(Tcl_UniChar) + (ualloc) \
+ : sizeof(String)))
#define GET_STRING(objPtr) \
((String *) (objPtr)->internalRep.otherValuePtr)
#define SET_STRING(objPtr, stringPtr) \