summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-09-28 19:24:51 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-09-28 19:24:51 (GMT)
commit4c1d56db0ef7325c1817833b5f178dd393fb54e9 (patch)
tree5c80a95f9eaf44dc70e7d029db553c3ac9bbb5e1 /generic/tclIO.c
parent023f68bcd4d6661b4a1ac20e9c90cc212f1901cc (diff)
downloadtcl-4c1d56db0ef7325c1817833b5f178dd393fb54e9.zip
tcl-4c1d56db0ef7325c1817833b5f178dd393fb54e9.tar.gz
tcl-4c1d56db0ef7325c1817833b5f178dd393fb54e9.tar.bz2
* generic/tclIO.c (Tcl_GetsObj): added two test'n'panic guards for
possible NULL derefs, [Bug 1566382] and coverity #33.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c8
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) {