[tracker/wip/carlosg/fixes: 14/14] libtracker-fts: Perform error checks throughout all FTS5 offsets API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/fixes: 14/14] libtracker-fts: Perform error checks throughout all FTS5 offsets API
- Date: Mon, 2 Mar 2020 22:07:17 +0000 (UTC)
commit c64e343511a4a68892e9b6f683cc5faae17f1b1b
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Feb 29 20:00:09 2020 +0100
libtracker-fts: Perform error checks throughout all FTS5 offsets API
We are trusting some of those functions to be correct, error out instead
if that doesn't happen to be the case.
src/libtracker-fts/tracker-fts-tokenizer.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-fts/tracker-fts-tokenizer.c b/src/libtracker-fts/tracker-fts-tokenizer.c
index a6244af9d..40cfabf74 100644
--- a/src/libtracker-fts/tracker-fts-tokenizer.c
+++ b/src/libtracker-fts/tracker-fts-tokenizer.c
@@ -220,6 +220,8 @@ tracker_offsets_function (const Fts5ExtensionApi *api,
int phrase, col, n_token;
rc = api->xInst (fts_ctx, i, &phrase, &col, &n_token);
+ if (rc != SQLITE_OK)
+ break;
if (first || cur_col != col) {
const char *text;
@@ -229,9 +231,15 @@ tracker_offsets_function (const Fts5ExtensionApi *api,
g_array_free (offsets, TRUE);
offsets = g_array_new (FALSE, FALSE, sizeof (gint));
- api->xColumnText (fts_ctx, col, &text, &length);
- api->xTokenize (fts_ctx, text, length,
- offsets, &offsets_tokenizer_func);
+ rc = api->xColumnText (fts_ctx, col, &text, &length);
+ if (rc != SQLITE_OK)
+ break;
+
+ rc = api->xTokenize (fts_ctx, text, length,
+ offsets, &offsets_tokenizer_func);
+ if (rc != SQLITE_OK)
+ break;
+
cur_col = col;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]