Skip to content

Commit eb6c681

Browse files
Update SQLite to 3.15.2
1 parent 2228fee commit eb6c681

27 files changed

+578
-87
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ If you need a specific version of SQLite, or specific SQLite compilation options
88

99

1010

11-
**November 4, 2016: Update SQLite to 3.15.1** ([changelog](CHANGELOG.md)).
11+
**December 3, 2016: Update SQLite to 3.15.2** ([changelog](CHANGELOG.md)).
1212

1313
**Requirements**: iOS 8.0+ / OSX 10.9+, Xcode 7.3+
1414

15-
**SQLite Included:** **[3.15.1](https://www.sqlite.org/releaselog/3_15_1.html)**
15+
**SQLite Included:** **[3.15.2](https://www.sqlite.org/releaselog/3_15_2.html)**
1616

1717

1818

@@ -65,7 +65,7 @@ There is no need to modify any other files.
6565

6666
#### Compiling a Specific Version of SQLite:
6767

68-
SQLiteLib currently ships with the source for SQLite 3.15.1.
68+
SQLiteLib currently ships with the source for SQLite 3.15.2.
6969

7070
If you'd like to compile a newer (or older) version, the process is simple:
7171

@@ -127,7 +127,7 @@ The built-in OSX/iOS version of SQLite were built with the following compilation
127127

128128
SQLiteLib uses these settings with one exception - on iOS:
129129

130-
The SQLite code (verified in: 3.15.1) uses a deprecated function (`gethostuuid()`).
130+
The SQLite code (verified in: 3.15.2) uses a deprecated function (`gethostuuid()`).
131131

132132
D. Richard Hipp (SQLite architect), suggests working around this on iOS using `-DSQLITE_ENABLE_LOCKING_STYLE=0`:
133133
> "The SQLITE_ENABLE_LOCKING_STYLE thing is an apple-only extension that
@@ -140,7 +140,7 @@ D. Richard Hipp (SQLite architect), suggests working around this on iOS using `-
140140
Thus, SQLiteLib uses `SQLITE_ENABLE_LOCKING_STYLE=1` on OSX,
141141
**but on iOS, SQLiteLib compiles with `ENABLE_LOCKING_STYLE=0`**.
142142

143-
This removes the code that uses the deprecated function, but doesn't get rid of the warning that "`gethostuuid() is disabled`" (as of 3.15.1).
143+
This removes the code that uses the deprecated function, but doesn't get rid of the warning that "`gethostuuid() is disabled`".
144144

145145
To prevent this warning, SQLiteLib separately specifies `-Wno-#warnings` when building for iOS.
146146

sqlite/Makefile.msc

+3-3
Original file line numberDiff line numberDiff line change
@@ -794,11 +794,11 @@ TCLLIBDIR = c:\tcl\lib
794794
!ENDIF
795795

796796
!IFNDEF LIBTCL
797-
LIBTCL = tcl85.lib
797+
LIBTCL = tcl86.lib
798798
!ENDIF
799799

800800
!IFNDEF LIBTCLSTUB
801-
LIBTCLSTUB = tclstub85.lib
801+
LIBTCLSTUB = tclstub86.lib
802802
!ENDIF
803803

804804
!IFNDEF LIBTCLPATH
@@ -828,7 +828,7 @@ LIBICU = icuuc.lib icuin.lib
828828
# specific Tcl shell to use.
829829
#
830830
!IFNDEF TCLSH_CMD
831-
TCLSH_CMD = tclsh85
831+
TCLSH_CMD = tclsh
832832
!ENDIF
833833
# <</mark>>
834834

sqlite/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.15.1
1+
3.15.2

sqlite/configure

+9-9
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.15.1.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.15.2.
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.15.1'
730-
PACKAGE_STRING='sqlite 3.15.1'
729+
PACKAGE_VERSION='3.15.2'
730+
PACKAGE_STRING='sqlite 3.15.2'
731731
PACKAGE_BUGREPORT=''
732732
PACKAGE_URL=''
733733

@@ -1463,7 +1463,7 @@ if test "$ac_init_help" = "long"; then
14631463
# Omit some internal or obsolete options to make the list less imposing.
14641464
# This message is too long to be a string in the A/UX 3.1 sh.
14651465
cat <<_ACEOF
1466-
\`configure' configures sqlite 3.15.1 to adapt to many kinds of systems.
1466+
\`configure' configures sqlite 3.15.2 to adapt to many kinds of systems.
14671467
14681468
Usage: $0 [OPTION]... [VAR=VALUE]...
14691469
@@ -1528,7 +1528,7 @@ fi
15281528

15291529
if test -n "$ac_init_help"; then
15301530
case $ac_init_help in
1531-
short | recursive ) echo "Configuration of sqlite 3.15.1:";;
1531+
short | recursive ) echo "Configuration of sqlite 3.15.2:";;
15321532
esac
15331533
cat <<\_ACEOF
15341534
@@ -1652,7 +1652,7 @@ fi
16521652
test -n "$ac_init_help" && exit $ac_status
16531653
if $ac_init_version; then
16541654
cat <<\_ACEOF
1655-
sqlite configure 3.15.1
1655+
sqlite configure 3.15.2
16561656
generated by GNU Autoconf 2.69
16571657
16581658
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2071,7 +2071,7 @@ cat >config.log <<_ACEOF
20712071
This file contains any messages produced by compilers while
20722072
running configure, to aid debugging if configure makes a mistake.
20732073
2074-
It was created by sqlite $as_me 3.15.1, which was
2074+
It was created by sqlite $as_me 3.15.2, which was
20752075
generated by GNU Autoconf 2.69. Invocation command line was
20762076
20772077
$ $0 $@
@@ -12151,7 +12151,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1215112151
# report actual input values of CONFIG_FILES etc. instead of their
1215212152
# values after options handling.
1215312153
ac_log="
12154-
This file was extended by sqlite $as_me 3.15.1, which was
12154+
This file was extended by sqlite $as_me 3.15.2, which was
1215512155
generated by GNU Autoconf 2.69. Invocation command line was
1215612156
1215712157
CONFIG_FILES = $CONFIG_FILES
@@ -12217,7 +12217,7 @@ _ACEOF
1221712217
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1221812218
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1221912219
ac_cs_version="\\
12220-
sqlite config.status 3.15.1
12220+
sqlite config.status 3.15.2
1222112221
configured by $0, generated by GNU Autoconf 2.69,
1222212222
with options \\"\$ac_cs_config\\"
1222312223

sqlite/ext/fts5/fts5_expr.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static int fts5ExprNodeTest_STRING(
920920
}
921921
}else{
922922
Fts5IndexIter *pIter = pPhrase->aTerm[j].pIter;
923-
if( pIter->iRowid==iLast ) continue;
923+
if( pIter->iRowid==iLast || pIter->bEof ) continue;
924924
bMatch = 0;
925925
if( fts5ExprAdvanceto(pIter, bDesc, &iLast, &rc, &pNode->bEof) ){
926926
return rc;

sqlite/ext/fts5/fts5_index.c

+1
Original file line numberDiff line numberDiff line change
@@ -2840,6 +2840,7 @@ static void fts5MultiIterNext(
28402840
i64 iFrom /* Advance at least as far as this */
28412841
){
28422842
int bUseFrom = bFrom;
2843+
assert( pIter->base.bEof==0 );
28432844
while( p->rc==SQLITE_OK ){
28442845
int iFirst = pIter->aFirst[1].iFirst;
28452846
int bNewTerm = 0;

sqlite/ext/fts5/test/fts5simple3.test

+34
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,40 @@ do_execsql_test 3.0 {
8080
SELECT * FROM x3('x OR y OR z');
8181
}
8282

83+
#-------------------------------------------------------------------------
84+
# Test that a crash occuring when the second or subsequent tokens in a
85+
# phrase matched zero rows has been fixed.
86+
#
87+
do_execsql_test 4.0 {
88+
CREATE VIRTUAL TABLE t1 USING fts5(x);
89+
INSERT INTO t1 VALUES('ab');
90+
INSERT INTO t1 VALUES('cd');
91+
INSERT INTO t1 VALUES('ab cd');
92+
INSERT INTO t1 VALUES('ab cdXXX');
93+
INSERT INTO t1 VALUES('abXXX cd');
94+
}
95+
do_execsql_test 4.1 {
96+
SELECT * FROM t1('"ab cd" OR "ab cd" *');
97+
} {{ab cd} {ab cdXXX}}
98+
do_execsql_test 4.2 {
99+
SELECT * FROM t1('"xy zz" OR "ab cd" *');
100+
} {{ab cd} {ab cdXXX}}
101+
do_execsql_test 4.3 {
102+
SELECT * FROM t1('"xy zz" OR "xy zz" *');
103+
}
104+
do_execsql_test 4.4 {
105+
SELECT * FROM t1('"ab cd" OR "xy zz" *');
106+
} {{ab cd}}
107+
do_execsql_test 4.5 {
108+
CREATE VIRTUAL TABLE t2 USING fts5(x);
109+
INSERT INTO t2 VALUES('ab');
110+
INSERT INTO t2 VALUES('cd');
111+
INSERT INTO t2 VALUES('ef');
112+
}
113+
do_execsql_test 4.6 {
114+
SELECT * FROM t2('ab + xyz');
115+
}
116+
83117

84118
finish_test
85119

sqlite/ext/icu/icu.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -500,20 +500,20 @@ int sqlite3IcuInit(sqlite3 *db){
500500
void *pContext; /* sqlite3_user_data() context */
501501
void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
502502
} scalars[] = {
503-
{"regexp", 2, SQLITE_ANY, 0, icuRegexpFunc},
503+
{"regexp", 2, SQLITE_ANY|SQLITE_DETERMINISTIC, 0, icuRegexpFunc},
504504

505-
{"lower", 1, SQLITE_UTF16, 0, icuCaseFunc16},
506-
{"lower", 2, SQLITE_UTF16, 0, icuCaseFunc16},
507-
{"upper", 1, SQLITE_UTF16, (void*)1, icuCaseFunc16},
508-
{"upper", 2, SQLITE_UTF16, (void*)1, icuCaseFunc16},
505+
{"lower", 1, SQLITE_UTF16|SQLITE_DETERMINISTIC, 0, icuCaseFunc16},
506+
{"lower", 2, SQLITE_UTF16|SQLITE_DETERMINISTIC, 0, icuCaseFunc16},
507+
{"upper", 1, SQLITE_UTF16|SQLITE_DETERMINISTIC, (void*)1, icuCaseFunc16},
508+
{"upper", 2, SQLITE_UTF16|SQLITE_DETERMINISTIC, (void*)1, icuCaseFunc16},
509509

510-
{"lower", 1, SQLITE_UTF8, 0, icuCaseFunc16},
511-
{"lower", 2, SQLITE_UTF8, 0, icuCaseFunc16},
512-
{"upper", 1, SQLITE_UTF8, (void*)1, icuCaseFunc16},
513-
{"upper", 2, SQLITE_UTF8, (void*)1, icuCaseFunc16},
510+
{"lower", 1, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuCaseFunc16},
511+
{"lower", 2, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuCaseFunc16},
512+
{"upper", 1, SQLITE_UTF8|SQLITE_DETERMINISTIC, (void*)1, icuCaseFunc16},
513+
{"upper", 2, SQLITE_UTF8|SQLITE_DETERMINISTIC, (void*)1, icuCaseFunc16},
514514

515-
{"like", 2, SQLITE_UTF8, 0, icuLikeFunc},
516-
{"like", 3, SQLITE_UTF8, 0, icuLikeFunc},
515+
{"like", 2, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuLikeFunc},
516+
{"like", 3, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuLikeFunc},
517517

518518
{"icu_load_collation", 2, SQLITE_UTF8, (void*)db, icuLoadCollation},
519519
};

sqlite/ext/misc/json1.c

+25-9
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ SQLITE_EXTENSION_INIT1
4949
#ifdef sqlite3Isdigit
5050
/* Use the SQLite core versions if this routine is part of the
5151
** SQLite amalgamation */
52-
# define safe_isdigit(x) sqlite3Isdigit(x)
53-
# define safe_isalnum(x) sqlite3Isalnum(x)
52+
# define safe_isdigit(x) sqlite3Isdigit(x)
53+
# define safe_isalnum(x) sqlite3Isalnum(x)
54+
# define safe_isxdigit(x) sqlite3Isxdigit(x)
5455
#else
5556
/* Use the standard library for separate compilation */
5657
#include <ctype.h> /* amalgamator: keep */
57-
# define safe_isdigit(x) isdigit((unsigned char)(x))
58-
# define safe_isalnum(x) isalnum((unsigned char)(x))
58+
# define safe_isdigit(x) isdigit((unsigned char)(x))
59+
# define safe_isalnum(x) isalnum((unsigned char)(x))
60+
# define safe_isxdigit(x) isxdigit((unsigned char)(x))
5961
#endif
6062

6163
/*
@@ -702,6 +704,15 @@ static int jsonParseAddNode(
702704
return pParse->nNode++;
703705
}
704706

707+
/*
708+
** Return true if z[] begins with 4 (or more) hexadecimal digits
709+
*/
710+
static int jsonIs4Hex(const char *z){
711+
int i;
712+
for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0;
713+
return 1;
714+
}
715+
705716
/*
706717
** Parse a single JSON value which begins at pParse->zJson[i]. Return the
707718
** index of the first character past the end of the value parsed.
@@ -776,8 +787,13 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
776787
if( c==0 ) return -1;
777788
if( c=='\\' ){
778789
c = pParse->zJson[++j];
779-
if( c==0 ) return -1;
780-
jnFlags = JNODE_ESCAPE;
790+
if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f'
791+
|| c=='n' || c=='r' || c=='t'
792+
|| (c=='u' && jsonIs4Hex(pParse->zJson+j+1)) ){
793+
jnFlags = JNODE_ESCAPE;
794+
}else{
795+
return -1;
796+
}
781797
}else if( c=='"' ){
782798
break;
783799
}
@@ -1645,7 +1661,7 @@ static void jsonObjectFinal(sqlite3_context *ctx){
16451661
if( pStr ){
16461662
jsonAppendChar(pStr, '}');
16471663
if( pStr->bErr ){
1648-
if( pStr->bErr==0 ) sqlite3_result_error_nomem(ctx);
1664+
if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
16491665
assert( pStr->bStatic );
16501666
}else{
16511667
sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
@@ -1923,9 +1939,9 @@ static int jsonEachColumn(
19231939
/* For json_each() path and root are the same so fall through
19241940
** into the root case */
19251941
}
1926-
case JEACH_ROOT: {
1942+
default: {
19271943
const char *zRoot = p->zRoot;
1928-
if( zRoot==0 ) zRoot = "$";
1944+
if( zRoot==0 ) zRoot = "$";
19291945
sqlite3_result_text(ctx, zRoot, -1, SQLITE_STATIC);
19301946
break;
19311947
}

0 commit comments

Comments
 (0)