Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-09-29
02:25 • Closed ticket [1566382fff]: NULL deref in Tcl_GetsObj? plus 7 other changes artifact: 4115dd621b user: msofer
2006-09-28
06:37 • Ticket [1566382fff]: 2 changes artifact: 19e69c03c7 user: hobbs
2006-09-27
22:56 • Ticket [1566382fff]: 4 changes artifact: bb116569a7 user: andreas_kupries
22:52 • Ticket [1566382fff]: 4 changes artifact: caaae1f3d8 user: msofer
22:21 • Ticket [1566382fff]: 4 changes artifact: 4517ffc41a user: andreas_kupries
14:36 • New ticket [1566382fff]. artifact: a492a57856 user: msofer

NULL deref in Tcl_GetsObj?

Closed / Fixed1566382fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-09-27 14:36:21
Coverity bug report #33 claims that bufPtr could be
NULL at line 3999 of tclIO.c (right after gotEOL:).

I've looked at it, and could not disprove it
immediately.  Due to the call to FilterInputBytes at
line 3825, either this line is not reached, or bufPtr
was not NULL to begin with, or bufPtr is set to
statePtr->inQueueTail.

I gave up right there, no use studying that whole logic
when others can do it much more efficiently: hence this
request for a look by a wiser maintainer.
andreas_kupriesplain2006-09-27 22:21:12
Logged In: YES 
user_id=75003

Does coverity provide information about the chain of events
which can lead to NULL ? I.e. why it is convinced that
bufPtr can be NULL at that location ? If yes this
infomration should be added to this report. The IO system is
complex enough that I do not wish to crawl through it given
that the coverity tools should have the info about I need to
reconstruct the problem. I.e. why should I/you search for
the code path to (dis)prove its conclusions if it can tell
us the code path in question.
msoferplain2006-09-27 22:52:11
Logged In: YES 
user_id=148712

Coverity has annotated and cross-ref'ed source. In their
parlance, this is FORWARD_NULL error. The relevant entries are:

* at line 3788
  <Event var_compare_op: Added "bufPtr" due to comparison
"bufPtr != 0">
(meaning: as you are comparing it to NULL, I assume it can
be NULL)

* at line 3809
<Event alias_transfer: Variable "(gs).bufPtr" tracked as
NULL because of assignment to "bufPtr">

* at line 3997
<Event alias_transfer: Variable "bufPtr" tracked as NULL
because of assignment to "(gs).bufPtr">

* at line 3999
<Event var_deref_op: Variable "bufPtr" tracked as NULL was
dereferenced.>
andreas_kupriesplain2006-09-27 22:56:44
Logged In: YES 
user_id=75003

Thanks. That should help.
hobbs Ticket [1566382fff]: 2 changes [History diff]2006-09-28 06:37:47
msoferplain2006-09-29 02:25:43
Logged In: YES 
user_id=148712

added two test'n'panic guards for possible NULL derefs
Log in (anonymous is fine) to add a comment.