diff options
author | das <das> | 2009-09-07 07:29:03 (GMT) |
---|---|---|
committer | das <das> | 2009-09-07 07:29:03 (GMT) |
commit | b1a164c0a1f1822b82ed874aa176a5e3da80122e (patch) | |
tree | 482f0c745521d3a4c67098b23132148476c35fbc /generic/tkTextBTree.c | |
parent | 71419c7600e07b055614f65a8617ff25e63c1603 (diff) | |
download | tk-b1a164c0a1f1822b82ed874aa176a5e3da80122e.zip tk-b1a164c0a1f1822b82ed874aa176a5e3da80122e.tar.gz tk-b1a164c0a1f1822b82ed874aa176a5e3da80122e.tar.bz2 |
* generic/tkFocus.c: fix potential null dereference flagged by clang
* generic/tkMenu.c: static analyzer.
* generic/tkTextBTree.c:
* generic/tkTextDisp.c:
* generic/tkTextIndex.c:
* generic/tkConsole.c: silence false positives from clang static
* generic/tkTest.c: analyzer about potential null dereference.
* generic/tkText.c:
* generic/tkTextBTree.c:
* generic/tkTextTag.c:
* generic/tkVisual.c:
Diffstat (limited to 'generic/tkTextBTree.c')
-rw-r--r-- | generic/tkTextBTree.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 381f72c..3d2efac 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.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: tkTextBTree.c,v 1.29 2009/04/10 15:53:24 das Exp $ + * RCS: @(#) $Id: tkTextBTree.c,v 1.30 2009/09/07 07:29:04 das Exp $ */ #include "tkInt.h" @@ -1233,8 +1233,9 @@ SplitSeg( /* * Reached end of the text. */ + } else { + segPtr = linePtr->segPtr; } - segPtr = linePtr->segPtr; } } Tcl_Panic("SplitSeg reached end of line!"); @@ -1389,6 +1390,7 @@ TkBTreeDeleteIndexRange( } } changeToLineCount++; + CLANG_ASSERT(curNodePtr); curNodePtr->numChildren--; /* @@ -2465,7 +2467,7 @@ FindTagStart( * level 0 node. */ - while (nodePtr->level > 0) { + while (nodePtr && nodePtr->level > 0) { for (nodePtr = nodePtr->children.nodePtr ; nodePtr != NULL; nodePtr = nodePtr->nextPtr) { for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL; @@ -2479,6 +2481,10 @@ FindTagStart( continue; } + if (nodePtr == NULL) { + return NULL; + } + /* * Work through the lines attached to the level-0 node. */ @@ -2546,7 +2552,7 @@ FindTagEnd( * level 0 node. */ - while (nodePtr->level > 0) { + while (nodePtr && nodePtr->level > 0) { for (lastNodePtr = NULL, nodePtr = nodePtr->children.nodePtr ; nodePtr != NULL; nodePtr = nodePtr->nextPtr) { for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL; @@ -2560,6 +2566,10 @@ FindTagEnd( nodePtr = lastNodePtr; } + if (nodePtr == NULL) { + return NULL; + } + /* * Work through the lines attached to the level-0 node. */ @@ -4277,9 +4287,11 @@ Rebalance( */ if (nodePtr->level == 0) { + CLANG_ASSERT(halfwayLinePtr); otherPtr->children.linePtr = halfwayLinePtr->nextPtr; halfwayLinePtr->nextPtr = NULL; } else { + CLANG_ASSERT(halfwayNodePtr); otherPtr->children.nodePtr = halfwayNodePtr->nextPtr; halfwayNodePtr->nextPtr = NULL; } |