[tracker/wip/phako/colomn-is-bound] libtracker-sparql: Check length in get_value_type



commit 492805d1f52b213af092840049b27823f03852c8
Author: Jens Georg <mail jensge org>
Date:   Sun May 24 20:14:56 2020 +0200

    libtracker-sparql: Check length in get_value_type
    
    types is a plain array; not checking returns something if we exceed the
    column limit.

 src/libtracker-bus/tracker-bus-fd-cursor.vala | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/libtracker-bus/tracker-bus-fd-cursor.vala b/src/libtracker-bus/tracker-bus-fd-cursor.vala
index 38128d945..954ad1ec7 100644
--- a/src/libtracker-bus/tracker-bus-fd-cursor.vala
+++ b/src/libtracker-bus/tracker-bus-fd-cursor.vala
@@ -56,6 +56,10 @@ class Tracker.Bus.FDCursor : Tracker.Sparql.Cursor {
 
        public override Sparql.ValueType get_value_type (int column)
        requires (types != null) {
+               if (column >= n_columns) {
+                       return Sparql.ValueType.UNBOUND;
+               }
+
                /* Cast from int to enum */
                return (Sparql.ValueType) types[column];
        }


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