[tracker/wip/carlosg/title-collator-invalid-reads: 1/2] libtracker-data: Handle SQLITE_DONE in tracker_triples filter()



commit e60bfcc568f927ef089babe16ee8c9262ab26e55
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 12 14:38:50 2019 +0200

    libtracker-data: Handle SQLITE_DONE in tracker_triples filter()
    
    The filter() function is meant to return SQLITE_OK or an error condition.
    The way to notify that a cursor is finished is returning TRUE on the next
    call to eof(), so just do that.
    
    Returning SQLITE_DONE here rather seems to stop query execution altogether
    (without apparent errors) than finishing this cursor, which will definitely
    bring side effects if the virtual table is being evaluated multiple times.

 src/libtracker-data/tracker-vtab-triples.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-vtab-triples.c b/src/libtracker-data/tracker-vtab-triples.c
index 78cae40cb..775e95b32 100644
--- a/src/libtracker-data/tracker-vtab-triples.c
+++ b/src/libtracker-data/tracker-vtab-triples.c
@@ -444,7 +444,10 @@ triples_filter (sqlite3_vtab_cursor  *vtab_cursor,
 
        rc = init_stmt (cursor);
 
-       if (rc == SQLITE_ROW)
+       if (rc == SQLITE_DONE)
+               cursor->finished = TRUE;
+
+       if (rc == SQLITE_ROW || rc == SQLITE_DONE)
                return SQLITE_OK;
 
        return rc;


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