Re: [PATCH] Fix GLib "critical" warning
- From: Peter Bloomfield <PeterBloomfield bellsouth net>
- To: balsa-list gnome org
- Subject: Re: [PATCH] Fix GLib "critical" warning
- Date: Fri, 07 Apr 2017 20:25:12 -0400
Hi Albrecht:
On 04/06/2017 04:11:44 PM Thu, Albrecht Dreß wrote:
Hi all,
I noticed that Balsa emits a critical warning on the console, e.g. when I select an encrypted message, but
cancel the decryption:
GLib-GIO-CRITICAL **: g_content_type_guess: assertion 'data_size != (gsize) -1' failed
Looking into the details, this message originates from balsa-mime-widget.c, function
balsa_mime_widget_new_unknown(), line 260 ff.
Apparently, in the case above, reading data from the stream fails (g_mime_stream_read() returns -1), but
libbalsa_vfs_content_type_of_buffer() is called with the broken data.
However, I wonder why this code does *not* crash:
(1) the buffer is allocated with a size of 1k,
(2) g_mime_stream_read() tries to fill it completely, so it is *not* NUL-terminated, but
(3) if libbalsa_vfs_content_type_of_buffer() guesses a text/* type, libbalsa_text_attr_string() is called
which assumes a NUL-terminated string.
The attached patch fixes both issues by
- checking if g_mime_stream_read() failed, and assuming application/octet-stream in this case and
- assuring that the buffer is always NUL-terminated.
I pushed this patch, and also the three POP3 patches, with the long-line-length patch.
Many thanks for all your efforts to keep Balsa moving forward!
Best,
Peter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]