[evolution-patches] resend, 313284, valgrind issues in camel stuff



hmm, i sent this but it didn't show up in the list.  resending.


I dont know how important these are, but they fix some minor bugs in the
code.  Some could lead to buffer overruns (reading only), which may end
up with invalid data elsewhere down the track.

It removes a bunch of warnings that users dont need to see too, like
charset things.


-- 
adfa(evolution-2.4:20087): gtkhtml-WARNING **: cannot find icon:
'stock_insert-url' in gnome 
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/ChangeLog,v
retrieving revision 1.2464
diff -u -p -r1.2464 ChangeLog
--- camel/ChangeLog	10 Aug 2005 02:05:39 -0000	1.2464
+++ camel/ChangeLog	12 Aug 2005 09:36:11 -0000
@@ -1,3 +1,31 @@
+2005-08-12  Not Zed  <NotZed Ximian com>
+
+	* camel-mime-filter-windows.c (filter_filter): same.
+
+	* camel-mime-filter-charset.c
+	(camel_mime_filter_charset_new_convert): remove another common
+	useless warning.
+
+	* camel-block-file.c (block_file_validate_root): ifdef out the
+	'invalid root' stuff.
+
+	* camel-folder-summary.c (summary_build_content_info): turn off
+	the annoying/pointless 'cannot convert xxx' message.
+
+	** See bug #313284.
+
+	* camel-mime-parser.c (folder_scan_content): make sure *data is
+	set to something before we exit.
+
+	* camel-mime-parser.c (folder_read): use memmove, not memcpy,
+	since memory areas could overlap.
+
+	* camel-html-parser.c (tokenise_step): use the length from the
+	utf8 conversion, it isn't 0 terminated.
+
+	* camel-mime-utils.c (header_decode_quoted_string): if we run out
+	of string, then don't go past the 0.
+
 2005-08-09  Not Zed  <NotZed Ximian com>
 
 	* camel-store.c (camel_store_get_folder): add some debug logging.
Index: camel/camel-block-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-block-file.c,v
retrieving revision 1.17
diff -u -p -r1.17 camel-block-file.c
--- camel/camel-block-file.c	26 Apr 2005 12:04:32 -0000	1.17
+++ camel/camel-block-file.c	12 Aug 2005 09:36:11 -0000
@@ -108,6 +108,7 @@ block_file_validate_root(CamelBlockFile 
 	    || st.st_size != br->last
 	    || br->free > st.st_size
 	    || (br->flags & CAMEL_BLOCK_FILE_SYNC) == 0) {
+#if 0
 		if (s != -1 && st.st_size > 0) {
 			g_warning("Invalid root: '%s'", bs->path);
 			g_warning("version: %.8s (%.8s)", bs->root->version, bs->version);
@@ -119,6 +120,7 @@ block_file_validate_root(CamelBlockFile 
 				  (br->last != st.st_size) || ((br->last % bs->block_size) != 0) ? " BAD": " OK");
 			g_warning("flags: %s", (br->flags & CAMEL_BLOCK_FILE_SYNC)?"SYNC":"unSYNC");
 		}
+#endif
 		return -1;
 	}
 
Index: camel/camel-folder-summary.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-folder-summary.c,v
retrieving revision 1.142
diff -u -p -r1.142 camel-folder-summary.c
--- camel/camel-folder-summary.c	11 May 2005 20:04:29 -0000	1.142
+++ camel/camel-folder-summary.c	12 Aug 2005 09:36:12 -0000
@@ -73,6 +73,7 @@ static pthread_mutex_t info_lock = PTHRE
 
 #define d(x)
 #define io(x)			/* io debug */
+#define w(x)
 
 #if 0
 extern int strdup_count, malloc_count, free_count;
@@ -2056,7 +2057,7 @@ summary_build_content_info(CamelFolderSu
 				if (mfc) {
 					chr_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)mfc);
 				} else {
-					g_warning("Cannot convert '%s' to 'UTF-8', message index may be corrupt", charset);
+					w(g_warning("Cannot convert '%s' to 'UTF-8', message index may be corrupt", charset));
 				}
 			}
 
Index: camel/camel-html-parser.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-html-parser.c,v
retrieving revision 1.5
diff -u -p -r1.5 camel-html-parser.c
--- camel/camel-html-parser.c	1 Dec 2004 03:03:09 -0000	1.5
+++ camel/camel-html-parser.c	12 Aug 2005 09:36:12 -0000
@@ -749,7 +749,7 @@ static int tokenise_step(CamelHTMLParser
 					g_string_append_c(p->values->pdata[p->attr], ';');
 				} else {
 					d(printf("got entity: %s = %s\n", p->ent->str, p->ent_utf8));
-					g_string_append(p->values->pdata[p->attr], p->ent_utf8);
+					g_string_append_len(p->values->pdata[p->attr], p->ent_utf8, len);
 				}
 			} else if (isalnum(c) || c=='#') { /* FIXME: right type */
 				g_string_append_c(p->ent, c);
Index: camel/camel-mime-filter-charset.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-filter-charset.c,v
retrieving revision 1.30
diff -u -p -r1.30 camel-mime-filter-charset.c
--- camel/camel-mime-filter-charset.c	5 May 2005 20:51:34 -0000	1.30
+++ camel/camel-mime-filter-charset.c	12 Aug 2005 09:36:12 -0000
@@ -33,6 +33,7 @@
 #include "camel-charset-map.h"
 
 #define d(x)
+#define w(x)
 
 static void camel_mime_filter_charset_class_init (CamelMimeFilterCharsetClass *klass);
 static void camel_mime_filter_charset_init       (CamelMimeFilterCharset *obj);
@@ -274,10 +275,10 @@ camel_mime_filter_charset_new_convert (c
 	
 	new->ic = e_iconv_open (to_charset, from_charset);
 	if (new->ic == (iconv_t) -1) {
-		g_warning ("Cannot create charset conversion from %s to %s: %s",
-			   from_charset ? from_charset : "(null)",
-			   to_charset ? to_charset : "(null)",
-			   g_strerror (errno));
+		w(g_warning ("Cannot create charset conversion from %s to %s: %s",
+			     from_charset ? from_charset : "(null)",
+			     to_charset ? to_charset : "(null)",
+			     g_strerror (errno)));
 		camel_object_unref (new);
 		new = NULL;
 	} else {
Index: camel/camel-mime-filter-windows.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-filter-windows.c,v
retrieving revision 1.4
diff -u -p -r1.4 camel-mime-filter-windows.c
--- camel/camel-mime-filter-windows.c	6 May 2005 19:06:03 -0000	1.4
+++ camel/camel-mime-filter-windows.c	12 Aug 2005 09:36:12 -0000
@@ -34,15 +34,14 @@
 #include "camel-charset-map.h"
 
 #define d(x)
+#define w(x)
 
 static void camel_mime_filter_windows_class_init (CamelMimeFilterWindowsClass *klass);
 static void camel_mime_filter_windows_init       (CamelObject *o);
 static void camel_mime_filter_windows_finalize   (CamelObject *o);
 
-
 static CamelMimeFilterClass *parent_class = NULL;
 
-
 CamelType
 camel_mime_filter_windows_get_type (void)
 {
@@ -95,8 +94,8 @@ filter_filter (CamelMimeFilter *filter, 
 			register unsigned char c = *inptr++;
 			
 			if (c >= 128 && c <= 159) {
-				g_warning ("Encountered Windows charset masquerading as %s",
-					   windows->claimed_charset);
+				w(g_warning ("Encountered Windows charset masquerading as %s",
+					     windows->claimed_charset));
 				windows->is_windows = TRUE;
 				break;
 			}
Index: camel/camel-mime-parser.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-parser.c,v
retrieving revision 1.64
diff -u -p -r1.64 camel-mime-parser.c
--- camel/camel-mime-parser.c	5 May 2005 18:38:48 -0000	1.64
+++ camel/camel-mime-parser.c	12 Aug 2005 09:36:12 -0000
@@ -904,7 +904,7 @@ folder_read(struct _header_scan_state *s
 	/* check for any remaning bytes (under the atleast limit( */
 	inoffset = s->inend - s->inptr;
 	if (inoffset>0) {
-		memcpy(s->inbuf, s->inptr, inoffset);
+		memmove(s->inbuf, s->inptr, inoffset);
 	}
 	if (s->stream) {
 		len = camel_stream_read(s->stream, s->inbuf+inoffset, SCAN_BUF-inoffset);
@@ -1382,6 +1382,7 @@ folder_scan_content(struct _header_scan_
 	}
 
 	*length = 0;
+	*data = s->inptr;
 	s->atleast = atleast;
 	return NULL;
 
Index: camel/camel-mime-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-utils.c,v
retrieving revision 1.231
diff -u -p -r1.231 camel-mime-utils.c
--- camel/camel-mime-utils.c	9 Aug 2005 05:44:19 -0000	1.231
+++ camel/camel-mime-utils.c	12 Aug 2005 09:36:13 -0000
@@ -1852,12 +1852,15 @@ header_decode_quoted_string(const char *
 		}
 		outlen = intmp-inptr-skip;
 		out = outptr = g_malloc(outlen+1);
-		while ( (c = *inptr++) && c!= '"') {
+		while ( (c = *inptr) && c!= '"') {
+			inptr++;
 			if (c=='\\' && *inptr) {
 				c = *inptr++;
 			}
 			*outptr++ = c;
 		}
+		if (c)
+			inptr++;
 		*outptr = '\0';
 	}
 	*in = inptr;


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