GNOME Bugzilla – Bug 674319
gupnp_didl_lite_contributor_get_name crashes when invoked on a contributor that contains an empty artist tag
Last modified: 2019-02-22 05:57:33 UTC
Created attachment 212278 [details] [review] Patch to fix crash in gupnp_didl_lite_contributor_get_name The crash occurs if the DIDL used to create the contributor contains an empty artist tag, e.g., <upnp:artist></upnp:artist>. A call to gupnp_didl_lite_object_get_artists results in a list of one element. Unfortunately, invoking gupnp_didl_lite_contributor_get_name on this element causes a crash. Please find attached a patch that addresses this problem. The fix works by modifying get_contributor_list_by_name so that it does not add empty artists nodes to the list of contributors it creates. The patch consider empty artists tags to be useless and it ignores them. It does this even if they contain a role. This behaviour is consistent with the deprecated gupnp_didl_lite_object_get_artist function that I believe will return NULL if the DIDL contains an empty artist tag, implying that an artist has not been specified. An alternative would be to modify gupnp_didl_lite_contributor_get_name to return NULL or an empty string, if the artists tag is empty. This would allow clients to retrieve the role attribute specified for an empty artist tag. However, I'm not sure how useful this would be.
Review of attachment 212278 [details] [review]: Looks good.
Created attachment 212413 [details] [review] Add regression test for bgo#674319
Created attachment 212414 [details] [review] Add regression test for bgo#674319 Adapt to new behaviour