committed On Wed, 2004-09-01 at 15:51 -0400, Jeffrey Stedfast wrote: > When replying to messages, the EMFormat *source pointer is non-NULL but > the ::clone() method doesn't copy it over to the emfq object (in my > case ::charset is NULL and ::default_charset is UTF-8) and so we end up > trying to create a charset filter from NULL to UTF-8, which of course > fails. Since no charset conversion ends up being done, we end up passing > raw binary garbage to the e_trie_search() function in the tohtml filter > and it crashes. > > The attached patch fixes this bug by making sure to clone the > default_charset as well as the normal charset (which is all that was > done before). This makes sure that when replying, the resultant charset > to convert to UTF-8 is non-NULL. > > *however* there are a few places in the code that call > em_utils_message_to_html() with a NULL source object and so the above > fix won't cover those cases. To fix these cases, I've added code to > message_to_html() to check gconf for the preferred charset and use that > in the case whre the source object is NULL. > > Jeff > > Plain text document attachment (63377.patch) > ? 55303-2.patch > ? 55303.patch > ? 62377.patch > ? 62665.patch > ? 62771-mailer.patch > ? 62812.patch > ? 63177.patch > ? 63377.patch > Index: ChangeLog > =================================================================== > RCS file: /cvs/gnome/evolution/mail/ChangeLog,v > retrieving revision 1.3448 > diff -u -r1.3448 ChangeLog > --- ChangeLog 31 Aug 2004 15:45:48 -0000 1.3448 > +++ ChangeLog 1 Sep 2004 19:44:51 -0000 > @@ -1,3 +1,16 @@ > +2004-09-01 Jeffrey Stedfast <fejj novell com> > + > + Fix for bug #63377 and prevention of similar cases. > + > + * em-format.c (emf_finalise): Free the default_charset. > + (emf_format_clone): Clone the default_charset - this prevents the > + particular crash described in bug #63377. > + > + * em-utils.c (em_utils_message_to_html): If source is NULL, set > + our own default charset (from the user's gconf key) on the > + formatter to make sure there's always a source charset for > + conversion to UTF-8. > + > 2004-08-30 Jeffrey Stedfast <fejj novell com> > > * em-folder-tree.c (emft_popup_delete_folder): Set the store and > Index: em-format.c > =================================================================== > RCS file: /cvs/gnome/evolution/mail/em-format.c,v > retrieving revision 1.38 > diff -u -r1.38 em-format.c > --- em-format.c 10 Jul 2004 01:31:04 -0000 1.38 > +++ em-format.c 1 Sep 2004 19:44:51 -0000 > @@ -137,6 +137,7 @@ > em_format_clear_headers(emf); > camel_cipher_validity_free(emf->valid); > g_free(emf->charset); > + g_free (emf->default_charset); > g_string_free(emf->part_id, TRUE); > > /* FIXME: check pending jobs */ > @@ -595,7 +596,9 @@ > emf->mode = emfsource->mode; > g_free(emf->charset); > emf->charset = g_strdup(emfsource->charset); > - > + g_free (emf->default_charset); > + emf->default_charset = g_strdup (emfsource->default_charset); > + > em_format_clear_headers(emf); > for (h = (struct _EMFormatHeader *)emfsource->header_list.head; h->next; h = h->next) > em_format_add_header(emf, h->name, h->flags); > Index: em-utils.c > =================================================================== > RCS file: /cvs/gnome/evolution/mail/em-utils.c,v > retrieving revision 1.51 > diff -u -r1.51 em-utils.c > --- em-utils.c 30 Aug 2004 18:53:45 -0000 1.51 > +++ em-utils.c 1 Sep 2004 19:44:51 -0000 > @@ -1458,6 +1458,18 @@ > > emfq = em_format_quote_new(credits, (CamelStream *)mem, flags); > em_format_set_session((EMFormat *)emfq, session); > + > + if (!source) { > + GConfClient *gconf; > + char *charset; > + > + gconf = gconf_client_get_default (); > + charset = gconf_client_get_string (gconf, "/apps/evolution/mail/display/charset", NULL); > + em_format_set_default_charset ((EMFormat *) emfq, charset); > + g_object_unref (gconf); > + g_free (charset); > + } > + > em_format_format_clone((EMFormat *)emfq, NULL, NULL, message, source); > g_object_unref (emfq); > -- Jeffrey Stedfast Evolution Hacker - Novell, Inc. fejj ximian com - www.novell.com
Attachment:
smime.p7s
Description: S/MIME cryptographic signature