gmediaserver-devel
[Top][All Lists]
Advanced

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

Re: [gmediaserver-devel] segmentation fault if there are no details for


From: Dmitry Samersoff
Subject: Re: [gmediaserver-devel] segmentation fault if there are no details for url-entry in playlist (contentdir.c get_entry_property)
Date: Sun, 12 Dec 2010 22:46:39 +0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6

Greg,

Thank you in advance!

-Dmitry

On 2010-12-12 22:28, Gerd Hofmann wrote:
There is a BUG in function get_entry_property in contentdir.c (cvs and
previous versions).

if (strcmp(property, "upnp:class") == 0) {
if (has_entry_detail(entry, DETAIL_CHILDREN))
return xstrdup("object.container.storageFolder");
/*if (has_entry_detail(entry, DETAIL_URL))
return xstrdup("object.item.audioItem.audioBroadcast");*/

detail = get_entry_detail(entry, DETAIL_FILE);
switch (detail->data.file.item_class) {
case ITEM_AUDIO:
return xstrdup("object.item.audioItem.musicTrack");
case ITEM_IMAGE:
return xstrdup("object.item.imageItem.photo");
case ITEM_VIDEO:
return xstrdup("object.item.videoItem.movie");
case ITEM_PLAYLIST:
case ITEM_TEXT:
case ITEM_UNKNOWN:
default:
/* FIXME */
return NULL;
}
}

A NULL-pointer check is missing after the call to get_entry_detail.
In my case there were no details (detail == NULL) for an url in a playlist.
So the next line ended up in a segmentation fault.

The following patch for contentdir.c from cvs fixes this issue:

--- contentdir.c.dist 2007-11-29 21:06:53.000000000 +0100
+++ contentdir.c 2010-12-12 11:57:37.000000000 +0100
@@ -101,20 +101,24 @@
return xstrdup("object.item.audioItem.audioBroadcast");*/
detail = get_entry_detail(entry, DETAIL_FILE);
- switch (detail->data.file.item_class) {
- case ITEM_AUDIO:
- return xstrdup("object.item.audioItem.musicTrack");
- case ITEM_IMAGE:
- return xstrdup("object.item.imageItem.photo");
- case ITEM_VIDEO:
- return xstrdup("object.item.videoItem.movie");
- case ITEM_PLAYLIST:
- case ITEM_TEXT:
- case ITEM_UNKNOWN:
- default:
- /* FIXME */
- return NULL;
+ if(detail) {
+ switch (detail->data.file.item_class) {
+ case ITEM_AUDIO:
+ return xstrdup("object.item.audioItem.musicTrack");
+ case ITEM_IMAGE:
+ return xstrdup("object.item.imageItem.photo");
+ case ITEM_VIDEO:
+ return xstrdup("object.item.videoItem.movie");
+ case ITEM_PLAYLIST:
+ case ITEM_TEXT:
+ case ITEM_UNKNOWN:
+ default:
+ /* FIXME */
+ return NULL;
+ }
}
+ else
+ return NULL;
}

if (detail != NULL) {


Gerd


_______________________________________________
GMediaServer-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/gmediaserver-devel


--
Dmitry Samersoff
address@hidden, http://devnull.samersoff.net
* I don't care if you're going nowhere. Just take good care of the world



reply via email to

[Prev in Thread] Current Thread [Next in Thread]