GNOME Bugzilla – Bug 743233
0.20.3: fix two GLib-CRITICAL warnings on strange input
Last modified: 2021-05-17 16:30:26 UTC
Created attachment 294964 [details] [review] Patch fixing the problem. libgupnp/gupnp-control-point's parse_usn function prints two GLib-CRITICAL warnings on weird input. The attached patch fixes these. The issue is that the second part of the string could be the empty string "" and g_strsplit reports an assertion failure string != NULL, and then g_strv_length reports a second assertion for str_array != NULL. The attached patch fixes this.
If you could also provide a test for that that would be awsome :)
I think that parse_usn("uuid:someuuid::", &foo, &bar); should trigger this. I'm not sure how to best make that into a test though.
Mhm. True, that's a bit ugly to write a test for :-/
Created attachment 295319 [details] [review] Ok, this seems to work and is abusing things just a little bit... Add test for bgo#743233 Signed-off-by: Jens Georg <mail@jensge.org>
Created attachment 295321 [details] [review] Add test for bgo#743233 Signed-off-by: Jens Georg <mail@jensge.org>
parse_usn("uuid:someuuid::", &foo, &bar); does not seem to trigger any criticals...
I still can't test the patch (see #743462), but from reading the patch I think it does not test what it claims to test -- gupnp_control_point_new is not called with TEST_BGO_743233_USN, but a different string.
That doesn't matter, the code and the data triggering the call of the parse_usn function is this: g_signal_emit_by_name (cp, "resource-unavailable", TEST_BGO_743233_USN); Though that should probably be documented. The idea was to use a UUID for the control point that cannot be triggered otherwise.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gupnp/-/issues/41.