GNOME Bugzilla – Bug 506772
glib-CRITICAL assertion in evolution-addressbook-export
Last modified: 2008-01-06 16:53:48 UTC
Please describe the problem: when using evolution-addressbook-export always a glib-CRITICAL assertion is printed out Steps to reproduce: 1. just call /usr/libexec/evolution/2.12/evolution-addressbook-export Actual results: the following error message is printed out on stderr: (evolution-addressbook-export:5098): GLib-CRITICAL **: g_strv_length: assertion `str_array != NULL' failed Expected results: no error message ;-) Does this happen every time? yes Other information: the reason is, that in evolution-addressbook-export.c, line 171 the variable "opt_remaining" is used as argument of g_strv_length, which expects an NULL terminated character array and not the NULL-pointer itself if there is no "remaining" option on the cmd line given then opt_remaining isn't touched and stays with it's initial value of NULL I'll attach a trivial patch against the trunk to fix the problem.
Created attachment 101962 [details] [review] small patch to fix the problem the patch fixes the problem for evolution-addressbook-export as well as for the evolution-backup tool
Looks fine. commit to trunk.
The first hunk looks good.. The second hunk can be improved as follows: + if (opt_remaining) + for (i = 0; i < g_strv_length (opt_remaining); i++) { instead of: - for (i = 0; opt_remaining && i < g_strv_length (opt_remaining); i++) { [Note that opt_remaining is not modified in-place within the loop and hence this suggestion is valid] That *would* save a few precious CPU cycles.
Created attachment 102271 [details] [review] alternative patch addressing comment #3 I've added an alternative patch which addresses the problems of comment #3. Please can anybody submit it to evolution SVN? Thanks! Best regards, Christian
If you trace the codepath, you'll observe that the backup/restore/check operations in backup.c would be operating on NULL or invalid strings due to uninitialized pointers. Fixed those issues in the committed patch. Committed to SVN trunk r34768 (http://svn.gnome.org/viewvc/evolution?view=revision&revision=34768) Please do attach ChangeLogs alongwith the patches. You can use this [1] script to prepare your own ChangeLogs :) [1] http://developer.gnome.org/tools/scripts/prepare-ChangeLog.pl