mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Fix an off-by-one in the code for limiting the depth of FTS expression trees.
FossilOrigin-Name: 72ac73189c3577740a77d2ea2fc7118391c0703f
This commit is contained in:
@@ -755,7 +755,7 @@ exprparse_out:
|
||||
static int fts3ExprCheckDepth(Fts3Expr *p, int nMaxDepth){
|
||||
int rc = SQLITE_OK;
|
||||
if( p ){
|
||||
if( nMaxDepth==0 ){
|
||||
if( nMaxDepth<0 ){
|
||||
rc = SQLITE_ERROR;
|
||||
}else{
|
||||
rc = fts3ExprCheckDepth(p->pLeft, nMaxDepth-1);
|
||||
|
||||
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\smmap1.test\sso\sthat\sit\spasses\son\swindows\sas\swell\sas\sunix.
|
||||
D 2013-04-29T09:17:42.276
|
||||
C Fix\san\soff-by-one\sin\sthe\scode\sfor\slimiting\sthe\sdepth\sof\sFTS\sexpression\strees.
|
||||
D 2013-04-29T17:12:06.416
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in ce81671efd6223d19d4c8c6b88ac2c4134427111
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -59,7 +59,7 @@ F ext/fts3/fts3.c 784aadfb4c2a217c3eb1feaecac924989f29728f
|
||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||
F ext/fts3/fts3Int.h 352c8a83ee4c6a14ced1759a39dd890ab947cbe0
|
||||
F ext/fts3/fts3_aux.c b02632f6dd0e375ce97870206d914ea6d8df5ccd
|
||||
F ext/fts3/fts3_expr.c 4021d21aadebb50499c482f6b7b718e4b93113e6
|
||||
F ext/fts3/fts3_expr.c 2449c3f31b87c3376b66999cdd10d23be0b0bd42
|
||||
F ext/fts3/fts3_hash.c 8dd2d06b66c72c628c2732555a32bc0943114914
|
||||
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
|
||||
F ext/fts3/fts3_icu.c e319e108661147bcca8dd511cd562f33a1ba81b5
|
||||
@@ -499,7 +499,7 @@ F test/fts3drop.test 1b906e293d6773812587b3dc458cb9e8f3f0c297
|
||||
F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851
|
||||
F test/fts3expr.test 5e745b2b6348499d9ef8d59015de3182072c564c
|
||||
F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a
|
||||
F test/fts3expr3.test aed4e71aa40ac1dcba860d1c43e7e23aa812eb1c
|
||||
F test/fts3expr3.test 1bfb762b53a794f990f3dffaae8bbea5736422f7
|
||||
F test/fts3fault.test cb72dccb0a3b9f730f16c5240f3fcb9303eb1660
|
||||
F test/fts3fault2.test 3198eef2804deea7cac8403e771d9cbcb752d887
|
||||
F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
|
||||
@@ -1060,7 +1060,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||
P e81e9ca11db09424dd310bbc91686a5daa618cb1
|
||||
R 0b5ca68b3c8f8712e6440b0981a1650e
|
||||
P 52417eac3ecaec2dbbde170334358f5ddbd32501
|
||||
R 9ce2a78bcb94198e11ae7a2e16b98558
|
||||
U dan
|
||||
Z 3af177977b6ccb1ab6aa9597c01ddcc6
|
||||
Z 54156ad010a8fff228c493eff10ae743
|
||||
|
||||
@@ -1 +1 @@
|
||||
52417eac3ecaec2dbbde170334358f5ddbd32501
|
||||
72ac73189c3577740a77d2ea2fc7118391c0703f
|
||||
@@ -149,7 +149,7 @@ for {set i 1} {$i < 100} {incr i} {
|
||||
|
||||
# Try trees of AND nodes with leaves that are themselves trees of OR nodes.
|
||||
#
|
||||
for {set i 2} {$i < 32} {incr i} {
|
||||
for {set i 2} {$i < 64} {incr i 4} {
|
||||
do_test 3.$i {
|
||||
test_fts3expr2 [random_andor_query $i]
|
||||
} [balanced_andor_tree $i]
|
||||
@@ -157,7 +157,7 @@ for {set i 2} {$i < 32} {incr i} {
|
||||
|
||||
# These exceed the depth limit.
|
||||
#
|
||||
for {set i 33} {$i < 40} {incr i} {
|
||||
for {set i 65} {$i < 70} {incr i} {
|
||||
do_test 3.$i {
|
||||
list [catch {test_fts3expr2 [random_andor_query $i]} msg] $msg
|
||||
} {1 {Error parsing expression}}
|
||||
@@ -165,13 +165,21 @@ for {set i 33} {$i < 40} {incr i} {
|
||||
|
||||
# This also exceeds the depth limit.
|
||||
#
|
||||
do_test 4.1 {
|
||||
|
||||
do_test 4.1.1 {
|
||||
set q "1"
|
||||
for {set i 2} {$i < 5000} {incr i} {
|
||||
append q " AND $i"
|
||||
}
|
||||
list [catch {test_fts3expr2 $q} msg] $msg
|
||||
} {1 {Error parsing expression}}
|
||||
do_test 4.1.2 {
|
||||
set q "1"
|
||||
for {set i 2} {$i < 4000} {incr i} {
|
||||
append q " AND $i"
|
||||
}
|
||||
catch {test_fts3expr2 $q}
|
||||
} {0}
|
||||
|
||||
proc create_toggle_tree {nDepth} {
|
||||
if {$nDepth == 0} { return xxx }
|
||||
|
||||
Reference in New Issue
Block a user