mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix a segfault in fts3 that may occur if the snippet, offsets or matchinfo functions are used in a query that does not contain a MATCH clause.
FossilOrigin-Name: 14ab536a96f81595ab8c3dcd4b72075f1a827c8b
This commit is contained in:
@ -432,7 +432,34 @@ foreach {DO_MALLOC_TEST enc} {
|
||||
{2 2 1 3 3 3 6 3 0 0 0 2 3 2}
|
||||
{2 2 1 3 3 3 6 3 0 0 0 2 3 2}
|
||||
}]
|
||||
|
||||
# EVIDENCE-OF: R-56101-59725 If used within a SELECT that uses the
|
||||
# "query by rowid" or "linear scan" strategies, then the snippet and
|
||||
# offsets both return an an empty string, and the matchinfo function
|
||||
# returns a blob value zero bytes in size.
|
||||
#
|
||||
set r 1000000 ;# A rowid that exists in table ft
|
||||
do_select_test $T.10.0 { SELECT rowid FROM ft WHERE rowid = $r } $r
|
||||
do_select_test $T.10.1 {
|
||||
SELECT length(offsets(ft)), typeof(offsets(ft)) FROM ft;
|
||||
} {0 text 0 text 0 text}
|
||||
do_select_test $T.10.2 {
|
||||
SELECT length(offsets(ft)), typeof(offsets(ft)) FROM ft WHERE rowid = $r
|
||||
} {0 text}
|
||||
do_select_test $T.10.3 {
|
||||
SELECT length(snippet(ft)), typeof(snippet(ft)) FROM ft;
|
||||
} {0 text 0 text 0 text}
|
||||
do_select_test $T.10.4 {
|
||||
SELECT length(snippet(ft)), typeof(snippet(ft)) FROM ft WHERE rowid = $r;
|
||||
} {0 text}
|
||||
do_select_test $T.10.5 {
|
||||
SELECT length(matchinfo(ft)), typeof(matchinfo(ft)) FROM ft;
|
||||
} {0 blob 0 blob 0 blob}
|
||||
do_select_test $T.10.6 {
|
||||
SELECT length(matchinfo(ft)), typeof(matchinfo(ft)) FROM ft WHERE rowid = $r
|
||||
} {0 blob}
|
||||
}
|
||||
|
||||
|
||||
set sqlite_fts3_enable_parentheses 0
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user