[rygel] core: Fix a potential crasher bug



commit 03b36b0b1ffdb0b18d92c7717284b2b9606e31ba
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Apr 12 18:45:47 2010 +0300

    core: Fix a potential crasher bug
    
    We were assuming that the 'CreateObject' action will always contain at
    least one item in the DIDL-Lite XML but that might not be the case. The
    client may very well try to only create container objects.
    
    This fixes crash against DLNA CTT test case 7.3.118.2.3.

 src/rygel/rygel-item-creator.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index 90c222b..ba7bfec 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -22,6 +22,10 @@
 
 using GUPnP;
 
+private errordomain Rygel.ItemCreatorError {
+    PARSE
+}
+
 /**
  * CreateObject action implementation.
  */
@@ -59,6 +63,11 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
                     this.didl_item = didl_item;
             });
             this.didl_parser.parse_didl (this.elements);
+            if (this.didl_item == null) {
+                throw new ItemCreatorError.PARSE ("Failed to find any item " +
+                                                  "in DIDL-Lite from client: " +
+                                                  this.elements);
+            }
 
             this.item = new MediaItem (didl_item.id,
                                        container,



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