Re: A stupid question about libtinymail



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Philip Van Hoof wrote:
> On Sun, 2007-12-02 at 03:27 +0200, Milko Krachounov wrote:
> 
>> In tny-gtk-text-buffer-stream.c, in the function
>> tny_gtk_text_buffer_stream_read_default, shouldn't the line:
>>
>> gtk_text_iter_set_offset (&dest, rlength);
>>
>> be
>>
>> gtk_text_iter_set_offset (&dest, cur_offset + rlength);
> 
> This has actually never been tested I think ...
> 
> So you might very well be right about that. Can you make a patch that
> makes it work for your case and send it to the mailing list?
> 
> I think the current other E-mail clients implement reading their text
> widget differently.
> 
> 
Erm, I've not implemented reading from my text widget at all at the
moment, I was looking at the code to see how it was implemented. I
noticed that it is incorrectly implemented and decided that I should
report it in some way. I decided not to write a patch, because I might
be overlooking something, and preferred to just point it out on the
mailing list, so that it can be confirmed. I'm sorry for the way I did
report it, but when it was in the middle of the night, and I was in a
terrible need of sleep -- I didn't even check the latest repository to
make sure it's not fixed already.

Currently the text is read from priv->cur to dest. dest points at
rlength. If I'm reading with 512 buffers, it will read from the 0 to 512
the first time, and will try from 512 to 512 the second time, and
strncpy should crash at this point.

I'm not competent enough to write a patch, because I could be off by
one, and I don't want to guess without testing, though I believe my
suggestion is correct, as the range doesn't include the end, according
to gtk_text_buffer_get_text documentation.

If I get to use or test that function, and it still hasn't been fixed,
I'll submit a tested patch.

Hope my message was helpful for improving your nice library, though. :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHUpwdZ2zN07dXrWoRAux9AKCjzU1NeexksSV5tcORDiXUAaLTfgCZAX4V
VNgPR3AxYP2xAq765KtAass=
=xmCR
-----END PGP SIGNATURE-----


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