summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclParse.c4
-rw-r--r--generic/tclStringObj.c8
3 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index dda014d..0cdffcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-09-24 Miguel Sofer <msofer@users.sf.net>
+
+ * 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
+
2006-09-22 Andreas Kupries <andreask@activestate.com>
* generic/tclInt.h: Moved TIP#268's field 'packagePrefer' to the
diff --git a/generic/tclParse.c b/generic/tclParse.c
index ec8c9f0..fc7a77c 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParse.c,v 1.25 2003/02/16 01:36:32 msofer Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.25.2.1 2006/09/24 21:15:10 msofer Exp $
*/
#include "tclInt.h"
@@ -238,7 +238,7 @@ Tcl_ParseCommand(interp, string, numBytes, nested, parsePtr)
* point to char after terminating one. */
int scanned;
- if ((string == NULL) && (numBytes>0)) {
+ if ((string == NULL) && (numBytes!=0)) {
if (interp != NULL) {
Tcl_SetResult(interp, "can't parse a NULL pointer", TCL_STATIC);
}
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) \