Re: [Libevent-users] Re: Dead or wrong code

2011-06-08 Thread Nick Mathewson
On Tue, Jun 7, 2011 at 5:58 PM, Nir Soffer wrote: > > On Jun 7, 2011, at 8:48 PM, Gilad Benjamini wrote: > 955         buf->first = chain; 956         if (chain) { 957             chain->misalign += remaining; 958             chain->off -= remaining; 959         } >>> >>>

Re: [Libevent-users] Re: Dead or wrong code

2011-06-07 Thread Nir Soffer
On Jun 7, 2011, at 8:48 PM, Gilad Benjamini wrote: 955 buf->first = chain; 956 if (chain) { 957 chain->misalign += remaining; 958 chain->off -= remaining; 959 } Draining all the buffer trigger this code. Adding an assert in line 957 cause the t

RE: [Libevent-users] Re: Dead or wrong code

2011-06-07 Thread Gilad Benjamini
>> 955 buf->first = chain; >> 956 if (chain) { >> 957 chain->misalign += remaining; >> 958 chain->off -= remaining; >> 959 } > >Draining all the buffer trigger this code. > >Adding an assert in line 957 cause the tests to die, so this code is >certa

[Libevent-users] Re: Dead or wrong code

2011-06-07 Thread Nir Soffer
evbuffer_drain has the code below. Can chain ever be NULL in line 956 ? If the while was completed due to the test in line 935, which dereferenced chain, it can’t. If the while was broken in line 950, then line 949 dereferenced chain, so it can’t be NULL either. I.e. either the test in line