Skip to content

Commit e714766

Browse files
committed
Snapshot of upstream SQLite 3.30.1
1 parent 400c015 commit e714766

File tree

212 files changed

+11465
-3538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+11465
-3538
lines changed

Makefile.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,6 @@ SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
609609
SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
610610
SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
611611
SHELL_OPT += -DSQLITE_ENABLE_DESERIALIZE
612-
SHELL_OPT += -DSQLITE_INTROSPECTION_PRAGMAS
613612
FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
614613
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
615614
FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000

Makefile.linux-gcc

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TOP = ../sqlite
1919
#### C Compiler and options for use in building executables that
2020
# will run on the platform that is doing the build.
2121
#
22-
BCC = gcc -g -O2
22+
BCC = gcc -g -O0
2323
#BCC = /opt/ancic/bin/c89 -0
2424

2525
#### If the target operating system supports the "usleep()" system
@@ -38,8 +38,8 @@ THREADSAFE = -DTHREADSAFE=0
3838
#### Specify any extra linker options needed to make the library
3939
# thread safe
4040
#
41-
#THREADLIB = -lpthread
42-
THREADLIB =
41+
THREADLIB = -lpthread -lm -ldl
42+
#THREADLIB =
4343

4444
#### Specify any extra libraries needed to access required functions.
4545
#
@@ -54,11 +54,9 @@ TLIBS =
5454
# You can make the library go almost twice as fast if you compile
5555
# with -DNDEBUG=1
5656
#
57-
#OPTS = -DSQLITE_DEBUG=2
58-
#OPTS = -DSQLITE_DEBUG=1
59-
#OPTS =
60-
OPTS = -DNDEBUG=1
61-
OPTS += -DHAVE_FDATASYNC=1
57+
OPTS += -DSQLITE_DEBUG=1
58+
OPTS += -DSQLITE_ENABLE_WHERETRACE
59+
OPTS += -DSQLITE_ENABLE_SELECTTRACE
6260

6361
#### The suffix to add to executable files. ".exe" for windows.
6462
# Nothing for unix.
@@ -70,7 +68,7 @@ EXE =
7068
# will run on the target platform. This is usually the same
7169
# as BCC, unless you are cross-compiling.
7270
#
73-
TCC = gcc -O6
71+
TCC = gcc -O0
7472
#TCC = gcc -g -O0 -Wall
7573
#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
7674
#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6
@@ -91,18 +89,12 @@ SHPREFIX = lib
9189

9290
#### Extra compiler options needed for programs that use the TCL library.
9391
#
94-
#TCL_FLAGS =
95-
#TCL_FLAGS = -DSTATIC_BUILD=1
96-
TCL_FLAGS = -I/home/drh/tcltk/8.5linux
97-
#TCL_FLAGS = -I/home/drh/tcltk/8.5win -DSTATIC_BUILD=1
98-
#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux
92+
TCL_FLAGS = -I/home/drh/tcl/include/tcl8.6
9993

10094
#### Linker options needed to link against the TCL library.
10195
#
10296
#LIBTCL = -ltcl -lm -ldl
103-
LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl
104-
#LIBTCL = /home/drh/tcltk/8.5win/libtcl85s.a -lmsvcrt
105-
#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
97+
LIBTCL = /home/drh/tcl/lib/libtcl8.6.a -lm -lpthread -ldl -lz
10698

10799
#### Additional objects for SQLite library when TCL support is enabled.
108100
#TCLOBJ =

Makefile.msc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ API_ARMOR = 0
7373
!IFNDEF NO_WARN
7474
!IF $(USE_FULLWARN)!=0
7575
NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
76-
NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706
76+
NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
7777
!ENDIF
7878
!ENDIF
7979

@@ -351,7 +351,6 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
351351
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
352352
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
353353
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
354-
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_INTROSPECTION_PRAGMAS=1
355354
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DESERIALIZE=1
356355
!ENDIF
357356
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.29.0
1+
3.30.1

autoconf/Makefile.msc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ API_ARMOR = 0
7373
!IFNDEF NO_WARN
7474
!IF $(USE_FULLWARN)!=0
7575
NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
76-
NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706
76+
NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
7777
!ENDIF
7878
!ENDIF
7979

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for sqlite 3.29.0.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.30.1.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
726726
# Identity of this package.
727727
PACKAGE_NAME='sqlite'
728728
PACKAGE_TARNAME='sqlite'
729-
PACKAGE_VERSION='3.29.0'
730-
PACKAGE_STRING='sqlite 3.29.0'
729+
PACKAGE_VERSION='3.30.1'
730+
PACKAGE_STRING='sqlite 3.30.1'
731731
PACKAGE_BUGREPORT=''
732732
PACKAGE_URL=''
733733

@@ -1466,7 +1466,7 @@ if test "$ac_init_help" = "long"; then
14661466
# Omit some internal or obsolete options to make the list less imposing.
14671467
# This message is too long to be a string in the A/UX 3.1 sh.
14681468
cat <<_ACEOF
1469-
\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems.
1469+
\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems.
14701470
14711471
Usage: $0 [OPTION]... [VAR=VALUE]...
14721472
@@ -1531,7 +1531,7 @@ fi
15311531

15321532
if test -n "$ac_init_help"; then
15331533
case $ac_init_help in
1534-
short | recursive ) echo "Configuration of sqlite 3.29.0:";;
1534+
short | recursive ) echo "Configuration of sqlite 3.30.1:";;
15351535
esac
15361536
cat <<\_ACEOF
15371537
@@ -1657,7 +1657,7 @@ fi
16571657
test -n "$ac_init_help" && exit $ac_status
16581658
if $ac_init_version; then
16591659
cat <<\_ACEOF
1660-
sqlite configure 3.29.0
1660+
sqlite configure 3.30.1
16611661
generated by GNU Autoconf 2.69
16621662
16631663
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2076,7 +2076,7 @@ cat >config.log <<_ACEOF
20762076
This file contains any messages produced by compilers while
20772077
running configure, to aid debugging if configure makes a mistake.
20782078
2079-
It was created by sqlite $as_me 3.29.0, which was
2079+
It was created by sqlite $as_me 3.30.1, which was
20802080
generated by GNU Autoconf 2.69. Invocation command line was
20812081
20822082
$ $0 $@
@@ -12232,7 +12232,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1223212232
# report actual input values of CONFIG_FILES etc. instead of their
1223312233
# values after options handling.
1223412234
ac_log="
12235-
This file was extended by sqlite $as_me 3.29.0, which was
12235+
This file was extended by sqlite $as_me 3.30.1, which was
1223612236
generated by GNU Autoconf 2.69. Invocation command line was
1223712237
1223812238
CONFIG_FILES = $CONFIG_FILES
@@ -12298,7 +12298,7 @@ _ACEOF
1229812298
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1229912299
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1230012300
ac_cs_version="\\
12301-
sqlite config.status 3.29.0
12301+
sqlite config.status 3.30.1
1230212302
configured by $0, generated by GNU Autoconf 2.69,
1230312303
with options \\"\$ac_cs_config\\"
1230412304

ext/expert/expert1.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ do_setup_rec_test $tn.5 {
134134
SEARCH TABLE t1 USING COVERING INDEX t1_idx_000123a7 (a=?)
135135
}
136136

137+
if 0 {
137138
do_setup_rec_test $tn.6 {
138139
CREATE TABLE t1(a, b, c);
139140
} {
@@ -142,6 +143,7 @@ do_setup_rec_test $tn.6 {
142143
CREATE INDEX t1_idx_00000061 ON t1(a);
143144
SEARCH TABLE t1 USING COVERING INDEX t1_idx_00000061
144145
}
146+
}
145147

146148
do_setup_rec_test $tn.7 {
147149
CREATE TABLE t1(a, b, c);

ext/fts3/fts3.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,18 @@
308308
SQLITE_EXTENSION_INIT1
309309
#endif
310310

311+
/*
312+
** The following are copied from sqliteInt.h.
313+
**
314+
** Constants for the largest and smallest possible 64-bit signed integers.
315+
** These macros are designed to work correctly on both 32-bit and 64-bit
316+
** compilers.
317+
*/
318+
#ifndef SQLITE_AMALGAMATION
319+
# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
320+
# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)
321+
#endif
322+
311323
static int fts3EvalNext(Fts3Cursor *pCsr);
312324
static int fts3EvalStart(Fts3Cursor *pCsr);
313325
static int fts3TermSegReaderCursor(
@@ -2086,10 +2098,11 @@ static void fts3ColumnlistCopy(char **pp, char **ppPoslist){
20862098
}
20872099

20882100
/*
2089-
** Value used to signify the end of an position-list. This is safe because
2090-
** it is not possible to have a document with 2^31 terms.
2101+
** Value used to signify the end of an position-list. This must be
2102+
** as large or larger than any value that might appear on the
2103+
** position-list, even a position list that has been corrupted.
20912104
*/
2092-
#define POSITION_LIST_END 0x7fffffff
2105+
#define POSITION_LIST_END LARGEST_INT64
20932106

20942107
/*
20952108
** This function is used to help parse position-lists. When this function is
@@ -2165,14 +2178,14 @@ static int fts3PoslistMerge(
21652178
fts3GetVarint32(&p1[1], &iCol1);
21662179
if( iCol1==0 ) return FTS_CORRUPT_VTAB;
21672180
}
2168-
else if( *p1==POS_END ) iCol1 = POSITION_LIST_END;
2181+
else if( *p1==POS_END ) iCol1 = 0x7fffffff;
21692182
else iCol1 = 0;
21702183

21712184
if( *p2==POS_COLUMN ){
21722185
fts3GetVarint32(&p2[1], &iCol2);
21732186
if( iCol2==0 ) return FTS_CORRUPT_VTAB;
21742187
}
2175-
else if( *p2==POS_END ) iCol2 = POSITION_LIST_END;
2188+
else if( *p2==POS_END ) iCol2 = 0x7fffffff;
21762189
else iCol2 = 0;
21772190

21782191
if( iCol1==iCol2 ){
@@ -2474,7 +2487,8 @@ static void fts3PutDeltaVarint3(
24742487
iWrite = *piPrev - iVal;
24752488
}
24762489
assert( *pbFirst || *piPrev==0 );
2477-
assert( *pbFirst==0 || iWrite>0 );
2490+
assert_fts3_nc( *pbFirst==0 || iWrite>0 );
2491+
assert( *pbFirst==0 || iWrite>=0 );
24782492
*pp += sqlite3Fts3PutVarint(*pp, iWrite);
24792493
*piPrev = iVal;
24802494
*pbFirst = 1;
@@ -2580,6 +2594,8 @@ static int fts3DoclistOrMerge(
25802594
fts3PoslistCopy(&p, &p2);
25812595
fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);
25822596
}
2597+
2598+
assert( (p-aOut)<=((p1?(p1-a1):n1)+(p2?(p2-a2):n2)+FTS3_VARINT_MAX-1) );
25832599
}
25842600

25852601
if( rc!=SQLITE_OK ){
@@ -3179,18 +3195,6 @@ static int fts3NextMethod(sqlite3_vtab_cursor *pCursor){
31793195
return rc;
31803196
}
31813197

3182-
/*
3183-
** The following are copied from sqliteInt.h.
3184-
**
3185-
** Constants for the largest and smallest possible 64-bit signed integers.
3186-
** These macros are designed to work correctly on both 32-bit and 64-bit
3187-
** compilers.
3188-
*/
3189-
#ifndef SQLITE_AMALGAMATION
3190-
# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
3191-
# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)
3192-
#endif
3193-
31943198
/*
31953199
** If the numeric type of argument pVal is "integer", then return it
31963200
** converted to a 64-bit signed integer. Otherwise, return a copy of

ext/fts3/fts3_snippet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ static void fts3SnippetDetails(
433433

434434
while( iCsr<(iStart+pIter->nSnippet) && iCsr>=iStart ){
435435
int j;
436-
u64 mPhrase = (u64)1 << i;
436+
u64 mPhrase = (u64)1 << (i%64);
437437
u64 mPos = (u64)1 << (iCsr - iStart);
438438
assert( iCsr>=iStart && (iCsr - iStart)<=64 );
439-
assert( i>=0 && i<=64 );
439+
assert( i>=0 );
440440
if( (mCover|mCovered)&mPhrase ){
441441
iScore++;
442442
}else{

ext/fts3/fts3_write.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3797,14 +3797,14 @@ static int nodeReaderInit(NodeReader *p, const char *aNode, int nNode){
37973797
p->nNode = nNode;
37983798

37993799
/* Figure out if this is a leaf or an internal node. */
3800-
if( p->aNode[0] ){
3800+
if( aNode && aNode[0] ){
38013801
/* An internal node. */
38023802
p->iOff = 1 + sqlite3Fts3GetVarint(&p->aNode[1], &p->iChild);
38033803
}else{
38043804
p->iOff = 1;
38053805
}
38063806

3807-
return nodeReaderNext(p);
3807+
return aNode ? nodeReaderNext(p) : SQLITE_OK;
38083808
}
38093809

38103810
/*
@@ -3941,6 +3941,7 @@ static int fts3AppendToNode(
39413941

39423942
nPrefix = fts3PrefixCompress(pPrev->a, pPrev->n, zTerm, nTerm);
39433943
nSuffix = nTerm - nPrefix;
3944+
if( nSuffix<=0 ) return FTS_CORRUPT_VTAB;
39443945
memcpy(pPrev->a, zTerm, nTerm);
39453946
pPrev->n = nTerm;
39463947

@@ -4295,8 +4296,8 @@ static int fts3IncrmergeLoad(
42954296
NodeReader reader;
42964297
pNode = &pWriter->aNodeWriter[i];
42974298

4298-
rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
4299-
if( reader.aNode ){
4299+
if( pNode->block.a){
4300+
rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
43004301
while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
43014302
blobGrowBuffer(&pNode->key, reader.term.n, &rc);
43024303
if( rc==SQLITE_OK ){

0 commit comments

Comments
 (0)