Skip to content

Commit a5fb731

Browse files
committed
Snapshot of upstream SQLite 3.43.1
1 parent c9d47f9 commit a5fb731

18 files changed

+200
-127
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.43.0
1+
3.43.1

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.43.0.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.43.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.43.0'
730-
PACKAGE_STRING='sqlite 3.43.0'
729+
PACKAGE_VERSION='3.43.1'
730+
PACKAGE_STRING='sqlite 3.43.1'
731731
PACKAGE_BUGREPORT=''
732732
PACKAGE_URL=''
733733

@@ -1470,7 +1470,7 @@ if test "$ac_init_help" = "long"; then
14701470
# Omit some internal or obsolete options to make the list less imposing.
14711471
# This message is too long to be a string in the A/UX 3.1 sh.
14721472
cat <<_ACEOF
1473-
\`configure' configures sqlite 3.43.0 to adapt to many kinds of systems.
1473+
\`configure' configures sqlite 3.43.1 to adapt to many kinds of systems.
14741474
14751475
Usage: $0 [OPTION]... [VAR=VALUE]...
14761476
@@ -1535,7 +1535,7 @@ fi
15351535

15361536
if test -n "$ac_init_help"; then
15371537
case $ac_init_help in
1538-
short | recursive ) echo "Configuration of sqlite 3.43.0:";;
1538+
short | recursive ) echo "Configuration of sqlite 3.43.1:";;
15391539
esac
15401540
cat <<\_ACEOF
15411541
@@ -1665,7 +1665,7 @@ fi
16651665
test -n "$ac_init_help" && exit $ac_status
16661666
if $ac_init_version; then
16671667
cat <<\_ACEOF
1668-
sqlite configure 3.43.0
1668+
sqlite configure 3.43.1
16691669
generated by GNU Autoconf 2.69
16701670
16711671
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2084,7 +2084,7 @@ cat >config.log <<_ACEOF
20842084
This file contains any messages produced by compilers while
20852085
running configure, to aid debugging if configure makes a mistake.
20862086
2087-
It was created by sqlite $as_me 3.43.0, which was
2087+
It was created by sqlite $as_me 3.43.1, which was
20882088
generated by GNU Autoconf 2.69. Invocation command line was
20892089
20902090
$ $0 $@
@@ -12457,7 +12457,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1245712457
# report actual input values of CONFIG_FILES etc. instead of their
1245812458
# values after options handling.
1245912459
ac_log="
12460-
This file was extended by sqlite $as_me 3.43.0, which was
12460+
This file was extended by sqlite $as_me 3.43.1, which was
1246112461
generated by GNU Autoconf 2.69. Invocation command line was
1246212462
1246312463
CONFIG_FILES = $CONFIG_FILES
@@ -12523,7 +12523,7 @@ _ACEOF
1252312523
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1252412524
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1252512525
ac_cs_version="\\
12526-
sqlite config.status 3.43.0
12526+
sqlite config.status 3.43.1
1252712527
configured by $0, generated by GNU Autoconf 2.69,
1252812528
with options \\"\$ac_cs_config\\"
1252912529

ext/fts3/fts3_write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5218,7 +5218,7 @@ static u64 fts3ChecksumIndex(
52185218
int rc;
52195219
u64 cksum = 0;
52205220

5221-
assert( *pRc==SQLITE_OK );
5221+
if( *pRc ) return 0;
52225222

52235223
memset(&filter, 0, sizeof(filter));
52245224
memset(&csr, 0, sizeof(csr));

ext/fts5/fts5_index.c

Lines changed: 63 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5198,80 +5198,79 @@ static void fts5DoSecureDelete(
51985198
}
51995199
}
52005200
}else if( iStart==4 ){
5201-
int iPgno;
5202-
5203-
assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
5204-
/* The entry being removed may be the only position list in
5205-
** its doclist. */
5206-
for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
5207-
Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
5208-
int bEmpty = (pPg && pPg->nn==4);
5209-
fts5DataRelease(pPg);
5210-
if( bEmpty==0 ) break;
5211-
}
5212-
5213-
if( iPgno==pSeg->iTermLeafPgno ){
5214-
i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
5215-
Fts5Data *pTerm = fts5DataRead(p, iId);
5216-
if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
5217-
u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
5218-
int nTermIdx = pTerm->nn - pTerm->szLeaf;
5219-
int iTermIdx = 0;
5220-
int iTermOff = 0;
5221-
5222-
while( 1 ){
5223-
u32 iVal = 0;
5224-
int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
5225-
iTermOff += iVal;
5226-
if( (iTermIdx+nByte)>=nTermIdx ) break;
5227-
iTermIdx += nByte;
5228-
}
5229-
nTermIdx = iTermIdx;
5201+
int iPgno;
5202+
5203+
assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
5204+
/* The entry being removed may be the only position list in
5205+
** its doclist. */
5206+
for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
5207+
Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
5208+
int bEmpty = (pPg && pPg->nn==4);
5209+
fts5DataRelease(pPg);
5210+
if( bEmpty==0 ) break;
5211+
}
5212+
5213+
if( iPgno==pSeg->iTermLeafPgno ){
5214+
i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
5215+
Fts5Data *pTerm = fts5DataRead(p, iId);
5216+
if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
5217+
u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
5218+
int nTermIdx = pTerm->nn - pTerm->szLeaf;
5219+
int iTermIdx = 0;
5220+
int iTermOff = 0;
5221+
5222+
while( 1 ){
5223+
u32 iVal = 0;
5224+
int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
5225+
iTermOff += iVal;
5226+
if( (iTermIdx+nByte)>=nTermIdx ) break;
5227+
iTermIdx += nByte;
5228+
}
5229+
nTermIdx = iTermIdx;
52305230

5231-
memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
5232-
fts5PutU16(&pTerm->p[2], iTermOff);
5231+
memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
5232+
fts5PutU16(&pTerm->p[2], iTermOff);
52335233

5234-
fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
5235-
if( nTermIdx==0 ){
5236-
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
5237-
}
5234+
fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
5235+
if( nTermIdx==0 ){
5236+
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
52385237
}
5239-
fts5DataRelease(pTerm);
52405238
}
5239+
fts5DataRelease(pTerm);
52415240
}
5241+
}
52425242

5243-
if( p->rc==SQLITE_OK ){
5244-
const int nMove = nPg - iNextOff;
5245-
int nShift = 0;
5246-
5247-
memmove(&aPg[iOff], &aPg[iNextOff], nMove);
5248-
iPgIdx -= (iNextOff - iOff);
5249-
nPg = iPgIdx;
5250-
fts5PutU16(&aPg[2], iPgIdx);
5251-
5252-
nShift = iNextOff - iOff;
5253-
for(iIdx=0, iKeyOff=0, iPrevKeyOff=0; iIdx<nIdx; /* no-op */){
5254-
u32 iVal = 0;
5255-
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
5256-
iKeyOff += iVal;
5257-
if( iKeyOff!=iDelKeyOff ){
5258-
if( iKeyOff>iOff ){
5259-
iKeyOff -= nShift;
5260-
nShift = 0;
5261-
}
5262-
nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOff - iPrevKeyOff);
5263-
iPrevKeyOff = iKeyOff;
5264-
}
5265-
}
5243+
if( p->rc==SQLITE_OK ){
5244+
const int nMove = nPg - iNextOff; /* Number of bytes to move */
5245+
int nShift = iNextOff - iOff; /* Distance to move them */
5246+
5247+
int iPrevKeyOut = 0;
5248+
int iKeyIn = 0;
52665249

5267-
if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
5268-
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
5250+
memmove(&aPg[iOff], &aPg[iNextOff], nMove);
5251+
iPgIdx -= nShift;
5252+
nPg = iPgIdx;
5253+
fts5PutU16(&aPg[2], iPgIdx);
5254+
5255+
for(iIdx=0; iIdx<nIdx; /* no-op */){
5256+
u32 iVal = 0;
5257+
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
5258+
iKeyIn += iVal;
5259+
if( iKeyIn!=iDelKeyOff ){
5260+
int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
5261+
nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
5262+
iPrevKeyOut = iKeyOut;
52695263
}
5264+
}
52705265

5271-
assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
5272-
fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg,nPg);
5266+
if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
5267+
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
52735268
}
5274-
sqlite3_free(aIdx);
5269+
5270+
assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
5271+
fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg);
5272+
}
5273+
sqlite3_free(aIdx);
52755274
}
52765275

52775276
/*

ext/fts5/test/fts5secure.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,19 @@ do_execsql_test 5.3 {
273273
do_execsql_test 5.4 { SELECT rowid FROM t1('abc'); } 2
274274
do_execsql_test 5.5 { SELECT rowid FROM t1('aa'); } 2
275275

276+
#-------------------------------------------------------------------------
277+
reset_db
278+
279+
do_execsql_test 6.0 {
280+
CREATE VIRTUAL TABLE fts USING fts5(content);
281+
INSERT INTO fts(fts, rank) VALUES ('secure-delete', 1);
282+
INSERT INTO fts(rowid, content) VALUES
283+
(3407, 'profile profile profile profile profile profile profile profile pull pulling pulling really');
284+
DELETE FROM fts WHERE rowid IS 3407;
285+
INSERT INTO fts(fts) VALUES ('integrity-check');
286+
}
287+
288+
276289

277290
finish_test
278291

ext/session/sqlite3session.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,15 +3236,19 @@ static int sessionReadRecord(
32363236
}
32373237
}
32383238
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
3239-
sqlite3_int64 v = sessionGetI64(aVal);
3240-
if( eType==SQLITE_INTEGER ){
3241-
sqlite3VdbeMemSetInt64(apOut[i], v);
3239+
if( (pIn->nData-pIn->iNext)<8 ){
3240+
rc = SQLITE_CORRUPT_BKPT;
32423241
}else{
3243-
double d;
3244-
memcpy(&d, &v, 8);
3245-
sqlite3VdbeMemSetDouble(apOut[i], d);
3242+
sqlite3_int64 v = sessionGetI64(aVal);
3243+
if( eType==SQLITE_INTEGER ){
3244+
sqlite3VdbeMemSetInt64(apOut[i], v);
3245+
}else{
3246+
double d;
3247+
memcpy(&d, &v, 8);
3248+
sqlite3VdbeMemSetDouble(apOut[i], d);
3249+
}
3250+
pIn->iNext += 8;
32463251
}
3247-
pIn->iNext += 8;
32483252
}
32493253
}
32503254
}

ext/wasm/GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,11 +845,11 @@ sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-frien
845845
sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js
846846
$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js)))
847847
$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.js),\
848-
$(c-pp.D.bundler-friendly)))
848+
$(c-pp.D.sqlite3-bundler-friendly)))
849849
$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.js)))
850850
$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),\
851851
$(sqlite3-worker1-promiser-bundler-friendly.js),\
852-
$(c-pp.D.bundler-friendly)))
852+
$(c-pp.D.sqlite3-bundler-friendly)))
853853
$(sqlite3-bundler-friendly.mjs): $(sqlite3-worker1-bundler-friendly.js) \
854854
$(sqlite3-worker1-promiser-bundler-friendly.js)
855855
$(sqlite3.js) $(sqlite3.mjs): $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js)

ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
890890
this.setAssociatedPath(sah, '', 0);
891891
toss("Expected to write "+n+" bytes but wrote "+nWrote+".");
892892
}else{
893+
sah.write(new Uint8Array([1,1]), {at: HEADER_OFFSET_DATA+18}
894+
/* force db out of WAL mode */);
893895
this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB);
894896
}
895897
}

ext/wasm/api/sqlite3-vfs-opfs.c-pp.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,16 +1192,25 @@ const installOpfsVfs = function callee(options){
11921192
toss("Input does not contain an SQLite database header.");
11931193
}
11941194
}
1195+
let sah;
11951196
const [hDir, fnamePart] = await opfsUtil.getDirForFilename(filename, true);
1196-
const hFile = await hDir.getFileHandle(fnamePart, {create:true});
1197-
const sah = await hFile.createSyncAccessHandle();
1198-
sah.truncate(0);
1199-
const nWrote = sah.write(bytes, {at: 0});
1200-
sah.close();
1201-
if(nWrote != n){
1202-
toss("Expected to write "+n+" bytes but wrote "+nWrote+".");
1197+
try {
1198+
const hFile = await hDir.getFileHandle(fnamePart, {create:true});
1199+
sah = await hFile.createSyncAccessHandle();
1200+
sah.truncate(0);
1201+
const nWrote = sah.write(bytes, {at: 0});
1202+
if(nWrote != n){
1203+
toss("Expected to write "+n+" bytes but wrote "+nWrote+".");
1204+
}
1205+
sah.write(new Uint8Array([1,1]), {at: 18}) /* force db out of WAL mode */;
1206+
return nWrote;
1207+
}catch(e){
1208+
if( sah ){ await sah.close(); sah = undefined; }
1209+
await hDir.removeEntry( fnamePart ).catch(()=>{});
1210+
throw e;
1211+
}finally{
1212+
if( sah ) await sah.close();
12031213
}
1204-
return nWrote;
12051214
};
12061215

12071216
if(sqlite3.oo1){

0 commit comments

Comments
 (0)