Comment # 3
on bug 90118
from Patrick Ohly
Comment on attachment 115232 [details] [review]
Avoid crash during the log
Review of attachment 115232 [details] [review]:
-----------------------------------------------------------------
The commit message needs to include information about the root cause for the
failure. As mentioned in the original bug report, this occurs when the "char *"
string isn't really UTF-8 encoded.
I am not convinced that silently ignoring the issue by replacing the actual
string with an empty one is the right thing to do. It's okay for a hotfix, but
not for inclusion upstream.
If it is a string created by SyncEvolution, then throwing an error is the right
thing to do. If it is a string coming from an uncertain source (like the
calendar event), then it would be better to sanitize the data before sending it
via D-Bus. For example, g_utf8_validate() could be used to copy just the valid
characters and replace the rest with a special character like ?
Unfortunately catching all places where invalid strings might be passed into
the gdbus layer is a lot of work, so pampering over the problem inside the
layer by sanitizing all "char *" strings might be the only viable approach.
Perhaps gdbus should not accept the ambiguous "char *" at all and instead rely
on the caller to convert to a "UTF8Char *" first, either by casting (string
known to be valid) or converting (untrusted string).