Commit c1f4fc26 authored by Carlos Garnacho's avatar Carlos Garnacho

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.
parent c00a5ee4
......@@ -233,6 +233,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;
......@@ -242,9 +244,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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment