[tracker/miner-fs-queries-performance] TrackerDBInterfaceSqlite: do sanity check on is_parent() and is_descendant().



commit 3920dd38bf5ff08e0d60eb5a45ea4e9786b37a80
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Apr 22 13:35:21 2010 +0200

    TrackerDBInterfaceSqlite: do sanity check on is_parent() and is_descendant().

 src/libtracker-db/tracker-db-interface-sqlite.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index 61aafbc..f2ee3f1 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -243,6 +243,14 @@ function_sparql_uri_is_parent (sqlite3_context *context,
 		return;
 	}
 
+	/* Check only one argument, it's going to
+	 * be compared with the other anyway.
+	 */
+	if (strstr (parent, "://") == NULL) {
+		sqlite3_result_int (context, FALSE);
+		return;
+	}
+
 	parent_len = strlen (parent);
 
 	/* Remove trailing '/', will
@@ -304,6 +312,14 @@ function_sparql_uri_is_descendant (sqlite3_context *context,
 		return;
 	}
 
+	/* Check only one argument, it's going to
+	 * be compared with the other anyway.
+	 */
+	if (strstr (parent, "://") == NULL) {
+		sqlite3_result_int (context, FALSE);
+		return;
+	}
+
 	parent_len = strlen (parent);
 
 	/* Remove trailing '/', will



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