diff options
author | msofer <msofer@noemail.net> | 2006-09-28 19:24:50 (GMT) |
---|---|---|
committer | msofer <msofer@noemail.net> | 2006-09-28 19:24:50 (GMT) |
commit | 19dcf924af3b36146644cedc33996a2de61ce34e (patch) | |
tree | 5c80a95f9eaf44dc70e7d029db553c3ac9bbb5e1 /generic | |
parent | cda7b81eac40d3882c181137109bde94ecf1453b (diff) | |
download | tcl-19dcf924af3b36146644cedc33996a2de61ce34e.zip tcl-19dcf924af3b36146644cedc33996a2de61ce34e.tar.gz tcl-19dcf924af3b36146644cedc33996a2de61ce34e.tar.bz2 |
* generic/tclIO.c (Tcl_GetsObj): added two test'n'panic guards for
possible NULL derefs, [Bug 1566382] and coverity #33.
FossilOrigin-Name: 22f85bac32a99897fe2ad92eb5e1ad83404bce17
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIO.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index f0553dd..689447b 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.108 2006/09/25 21:55:27 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.109 2006/09/28 19:24:52 msofer Exp $ */ #include "tclInt.h" @@ -3995,6 +3995,9 @@ Tcl_GetsObj( gotEOL: bufPtr = gs.bufPtr; + if (bufPtr == NULL) { + Tcl_Panic("Tcl_GetsObj: gotEOL reached with bufPtr==NULL"); + } statePtr->inputEncodingState = gs.state; Tcl_ExternalToUtf(NULL, gs.encoding, bufPtr->buf + bufPtr->nextRemoved, gs.rawRead, statePtr->inputEncodingFlags, @@ -4021,6 +4024,9 @@ Tcl_GetsObj( restore: bufPtr = statePtr->inQueueHead; + if (bufPtr == NULL) { + Tcl_Panic("Tcl_GetsObj: restore reached with bufPtr==NULL"); + } bufPtr->nextRemoved = oldRemoved; for (bufPtr = bufPtr->nextPtr; bufPtr != NULL; bufPtr = bufPtr->nextPtr) { |