[rygel] core: Return error on ivalid browse args



commit 508990ea3f0335cacb8467b5222f5ff07f1f0551
Author: Jens Georg <mail jensge org>
Date:   Tue May 24 18:21:04 2011 +0200

    core: Return error on ivalid browse args
    
    If StartingIndex < 0 or RequestCount < 0 we should return 402.
    
    This fixes UPnP CTT AV-CD:1.4.3

 src/rygel/rygel-media-query-action.vala |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/rygel-media-query-action.vala b/src/rygel/rygel-media-query-action.vala
index 0151e99..6ab893b 100644
--- a/src/rygel/rygel-media-query-action.vala
+++ b/src/rygel/rygel-media-query-action.vala
@@ -95,6 +95,7 @@ internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
     }
 
     protected virtual void parse_args () throws Error {
+        int64 index, requested_count;
         this.action.get (this.object_id_arg,
                              typeof (string),
                              out this.object_id,
@@ -102,11 +103,11 @@ internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
                              typeof (string),
                              out this.filter,
                          "StartingIndex",
-                             typeof (uint),
-                             out this.index,
+                             typeof (int64),
+                             out index,
                          "RequestedCount",
-                             typeof (uint),
-                             out this.requested_count,
+                             typeof (int64),
+                             out requested_count,
                          "SortCriteria",
                              typeof (string),
                              out this.sort_criteria);
@@ -117,6 +118,14 @@ internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
                                         (_("No such object"));
         }
 
+        if (index < 0 || requested_count < 0) {
+            throw new ContentDirectoryError.INVALID_ARGS
+                                        (_("Invalid range"));
+        }
+
+        this.index = (uint) index;
+        this.requested_count = (uint) requested_count;
+
         if (this.sort_criteria == null || this.sort_criteria == "") {
             this.sort_criteria = DEFAULT_SORT_CRITERIA;
         }



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