[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



#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
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs