[tor-bugs] #11824 [Tor]: tor_zlib_process fails when trying to finish with no input or output bytes.

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu May 8 17:02:51 UTC 2014


#11824: tor_zlib_process fails when trying to finish with no input or output bytes.
--------------------+------------------------------------
 Reporter:  nickm   |          Owner:
     Type:  defect  |         Status:  new
 Priority:  normal  |      Milestone:  Tor: 0.2.5.x-final
Component:  Tor     |        Version:
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
--------------------+------------------------------------
 zlib reports Z_BUF_ERROR when it is out of input or out of output.
 Currently, we handle that with:
 {{{
     case Z_BUF_ERROR:
       if (state->stream.avail_in == 0)
         return TOR_ZLIB_OK;
       return TOR_ZLIB_BUF_FULL;
 }}}

 But that's wrong -- if avail_in is 0, but finish is set, then we are
 trying to finalize the stream, and we really do have something to write.
 That test should be `state->stream.avail_in == 0 && !finish`)

 Marking this for 0.2.5 even though I am pretty sure this can never
 actually happen with the way write_to_buf_zlib works: write_to_buf_zlib
 ensures that we are never trying to write into a completely empty buffer,
 and zlib says "Z_OK" if you give it even one byte to write into.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11824>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list