Skip to content

Commit 3063f0c

Browse files
committed
Snapshot of upstream SQLite 3.39.4
1 parent a6c0401 commit 3063f0c

28 files changed

+310
-146
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.39.2
1+
3.39.4

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

@@ -1468,7 +1468,7 @@ if test "$ac_init_help" = "long"; then
14681468
# Omit some internal or obsolete options to make the list less imposing.
14691469
# This message is too long to be a string in the A/UX 3.1 sh.
14701470
cat <<_ACEOF
1471-
\`configure' configures sqlite 3.39.2 to adapt to many kinds of systems.
1471+
\`configure' configures sqlite 3.39.4 to adapt to many kinds of systems.
14721472
14731473
Usage: $0 [OPTION]... [VAR=VALUE]...
14741474
@@ -1533,7 +1533,7 @@ fi
15331533

15341534
if test -n "$ac_init_help"; then
15351535
case $ac_init_help in
1536-
short | recursive ) echo "Configuration of sqlite 3.39.2:";;
1536+
short | recursive ) echo "Configuration of sqlite 3.39.4:";;
15371537
esac
15381538
cat <<\_ACEOF
15391539
@@ -1661,7 +1661,7 @@ fi
16611661
test -n "$ac_init_help" && exit $ac_status
16621662
if $ac_init_version; then
16631663
cat <<\_ACEOF
1664-
sqlite configure 3.39.2
1664+
sqlite configure 3.39.4
16651665
generated by GNU Autoconf 2.69
16661666
16671667
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2080,7 +2080,7 @@ cat >config.log <<_ACEOF
20802080
This file contains any messages produced by compilers while
20812081
running configure, to aid debugging if configure makes a mistake.
20822082
2083-
It was created by sqlite $as_me 3.39.2, which was
2083+
It was created by sqlite $as_me 3.39.4, which was
20842084
generated by GNU Autoconf 2.69. Invocation command line was
20852085
20862086
$ $0 $@
@@ -12390,7 +12390,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1239012390
# report actual input values of CONFIG_FILES etc. instead of their
1239112391
# values after options handling.
1239212392
ac_log="
12393-
This file was extended by sqlite $as_me 3.39.2, which was
12393+
This file was extended by sqlite $as_me 3.39.4, which was
1239412394
generated by GNU Autoconf 2.69. Invocation command line was
1239512395
1239612396
CONFIG_FILES = $CONFIG_FILES
@@ -12456,7 +12456,7 @@ _ACEOF
1245612456
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1245712457
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1245812458
ac_cs_version="\\
12459-
sqlite config.status 3.39.2
12459+
sqlite config.status 3.39.4
1246012460
configured by $0, generated by GNU Autoconf 2.69,
1246112461
with options \\"\$ac_cs_config\\"
1246212462

ext/fts3/fts3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2888,7 +2888,7 @@ static int fts3TermSelectMerge(
28882888
**
28892889
** Similar padding is added in the fts3DoclistOrMerge() function.
28902890
*/
2891-
pTS->aaOutput[0] = sqlite3_malloc(nDoclist + FTS3_VARINT_MAX + 1);
2891+
pTS->aaOutput[0] = sqlite3_malloc64((i64)nDoclist + FTS3_VARINT_MAX + 1);
28922892
pTS->anOutput[0] = nDoclist;
28932893
if( pTS->aaOutput[0] ){
28942894
memcpy(pTS->aaOutput[0], aDoclist, nDoclist);
@@ -4376,7 +4376,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
43764376
nDistance = iPrev - nMaxUndeferred;
43774377
}
43784378

4379-
aOut = (char *)sqlite3_malloc(nPoslist+8);
4379+
aOut = (char *)sqlite3Fts3MallocZero(nPoslist+FTS3_BUFFER_PADDING);
43804380
if( !aOut ){
43814381
sqlite3_free(aPoslist);
43824382
return SQLITE_NOMEM;
@@ -4745,7 +4745,7 @@ static int fts3EvalIncrPhraseNext(
47454745
if( bEof==0 ){
47464746
int nList = 0;
47474747
int nByte = a[p->nToken-1].nList;
4748-
char *aDoclist = sqlite3_malloc(nByte+FTS3_BUFFER_PADDING);
4748+
char *aDoclist = sqlite3_malloc64((i64)nByte+FTS3_BUFFER_PADDING);
47494749
if( !aDoclist ) return SQLITE_NOMEM;
47504750
memcpy(aDoclist, a[p->nToken-1].pList, nByte+1);
47514751
memset(&aDoclist[nByte], 0, FTS3_BUFFER_PADDING);

ext/fts3/fts3Int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ struct Fts3MultiSegReader {
558558
int nAdvance; /* How many seg-readers to advance */
559559
Fts3SegFilter *pFilter; /* Pointer to filter object */
560560
char *aBuffer; /* Buffer to merge doclists in */
561-
int nBuffer; /* Allocated size of aBuffer[] in bytes */
561+
i64 nBuffer; /* Allocated size of aBuffer[] in bytes */
562562

563563
int iColFilter; /* If >=0, filter for this column */
564564
int bRestart;

ext/fts3/fts3_porter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ static int porterNext(
621621
if( n>c->nAllocated ){
622622
char *pNew;
623623
c->nAllocated = n+20;
624-
pNew = sqlite3_realloc(c->zToken, c->nAllocated);
624+
pNew = sqlite3_realloc64(c->zToken, c->nAllocated);
625625
if( !pNew ) return SQLITE_NOMEM;
626626
c->zToken = pNew;
627627
}

ext/fts3/fts3_tokenizer1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int simpleNext(
185185
if( n>c->nTokenAllocated ){
186186
char *pNew;
187187
c->nTokenAllocated = n+20;
188-
pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);
188+
pNew = sqlite3_realloc64(c->pToken, c->nTokenAllocated);
189189
if( !pNew ) return SQLITE_NOMEM;
190190
c->pToken = pNew;
191191
}

ext/fts3/fts3_write.c

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static int fts3PendingListAppendVarint(
649649

650650
/* Allocate or grow the PendingList as required. */
651651
if( !p ){
652-
p = sqlite3_malloc(sizeof(*p) + 100);
652+
p = sqlite3_malloc64(sizeof(*p) + 100);
653653
if( !p ){
654654
return SQLITE_NOMEM;
655655
}
@@ -658,14 +658,14 @@ static int fts3PendingListAppendVarint(
658658
p->nData = 0;
659659
}
660660
else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){
661-
int nNew = p->nSpace * 2;
662-
p = sqlite3_realloc(p, sizeof(*p) + nNew);
661+
i64 nNew = p->nSpace * 2;
662+
p = sqlite3_realloc64(p, sizeof(*p) + nNew);
663663
if( !p ){
664664
sqlite3_free(*pp);
665665
*pp = 0;
666666
return SQLITE_NOMEM;
667667
}
668-
p->nSpace = nNew;
668+
p->nSpace = (int)nNew;
669669
p->aData = (char *)&p[1];
670670
}
671671

@@ -1222,7 +1222,7 @@ int sqlite3Fts3ReadBlock(
12221222
int nByte = sqlite3_blob_bytes(p->pSegments);
12231223
*pnBlob = nByte;
12241224
if( paBlob ){
1225-
char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING);
1225+
char *aByte = sqlite3_malloc64((i64)nByte + FTS3_NODE_PADDING);
12261226
if( !aByte ){
12271227
rc = SQLITE_NOMEM;
12281228
}else{
@@ -1339,15 +1339,15 @@ static int fts3SegReaderNext(
13391339
int nTerm = fts3HashKeysize(pElem);
13401340
if( (nTerm+1)>pReader->nTermAlloc ){
13411341
sqlite3_free(pReader->zTerm);
1342-
pReader->zTerm = (char*)sqlite3_malloc((nTerm+1)*2);
1342+
pReader->zTerm = (char*)sqlite3_malloc64(((i64)nTerm+1)*2);
13431343
if( !pReader->zTerm ) return SQLITE_NOMEM;
13441344
pReader->nTermAlloc = (nTerm+1)*2;
13451345
}
13461346
memcpy(pReader->zTerm, fts3HashKey(pElem), nTerm);
13471347
pReader->zTerm[nTerm] = '\0';
13481348
pReader->nTerm = nTerm;
13491349

1350-
aCopy = (char*)sqlite3_malloc(nCopy);
1350+
aCopy = (char*)sqlite3_malloc64(nCopy);
13511351
if( !aCopy ) return SQLITE_NOMEM;
13521352
memcpy(aCopy, pList->aData, nCopy);
13531353
pReader->nNode = pReader->nDoclist = nCopy;
@@ -1634,7 +1634,7 @@ int sqlite3Fts3SegReaderNew(
16341634
nExtra = nRoot + FTS3_NODE_PADDING;
16351635
}
16361636

1637-
pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);
1637+
pReader = (Fts3SegReader *)sqlite3_malloc64(sizeof(Fts3SegReader) + nExtra);
16381638
if( !pReader ){
16391639
return SQLITE_NOMEM;
16401640
}
@@ -1726,7 +1726,7 @@ int sqlite3Fts3SegReaderPending(
17261726
if( nElem==nAlloc ){
17271727
Fts3HashElem **aElem2;
17281728
nAlloc += 16;
1729-
aElem2 = (Fts3HashElem **)sqlite3_realloc(
1729+
aElem2 = (Fts3HashElem **)sqlite3_realloc64(
17301730
aElem, nAlloc*sizeof(Fts3HashElem *)
17311731
);
17321732
if( !aElem2 ){
@@ -2060,7 +2060,7 @@ static int fts3NodeAddTerm(
20602060
** this is not expected to be a serious problem.
20612061
*/
20622062
assert( pTree->aData==(char *)&pTree[1] );
2063-
pTree->aData = (char *)sqlite3_malloc(nReq);
2063+
pTree->aData = (char *)sqlite3_malloc64(nReq);
20642064
if( !pTree->aData ){
20652065
return SQLITE_NOMEM;
20662066
}
@@ -2078,7 +2078,7 @@ static int fts3NodeAddTerm(
20782078

20792079
if( isCopyTerm ){
20802080
if( pTree->nMalloc<nTerm ){
2081-
char *zNew = sqlite3_realloc(pTree->zMalloc, nTerm*2);
2081+
char *zNew = sqlite3_realloc64(pTree->zMalloc, (i64)nTerm*2);
20822082
if( !zNew ){
20832083
return SQLITE_NOMEM;
20842084
}
@@ -2104,7 +2104,7 @@ static int fts3NodeAddTerm(
21042104
** now. Instead, the term is inserted into the parent of pTree. If pTree
21052105
** has no parent, one is created here.
21062106
*/
2107-
pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize);
2107+
pNew = (SegmentNode *)sqlite3_malloc64(sizeof(SegmentNode) + p->nNodeSize);
21082108
if( !pNew ){
21092109
return SQLITE_NOMEM;
21102110
}
@@ -2242,7 +2242,7 @@ static int fts3SegWriterAdd(
22422242
){
22432243
int nPrefix; /* Size of term prefix in bytes */
22442244
int nSuffix; /* Size of term suffix in bytes */
2245-
int nReq; /* Number of bytes required on leaf page */
2245+
i64 nReq; /* Number of bytes required on leaf page */
22462246
int nData;
22472247
SegmentWriter *pWriter = *ppWriter;
22482248

@@ -2251,13 +2251,13 @@ static int fts3SegWriterAdd(
22512251
sqlite3_stmt *pStmt;
22522252

22532253
/* Allocate the SegmentWriter structure */
2254-
pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));
2254+
pWriter = (SegmentWriter *)sqlite3_malloc64(sizeof(SegmentWriter));
22552255
if( !pWriter ) return SQLITE_NOMEM;
22562256
memset(pWriter, 0, sizeof(SegmentWriter));
22572257
*ppWriter = pWriter;
22582258

22592259
/* Allocate a buffer in which to accumulate data */
2260-
pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);
2260+
pWriter->aData = (char *)sqlite3_malloc64(p->nNodeSize);
22612261
if( !pWriter->aData ) return SQLITE_NOMEM;
22622262
pWriter->nSize = p->nNodeSize;
22632263

@@ -2332,7 +2332,7 @@ static int fts3SegWriterAdd(
23322332
** the buffer to make it large enough.
23332333
*/
23342334
if( nReq>pWriter->nSize ){
2335-
char *aNew = sqlite3_realloc(pWriter->aData, nReq);
2335+
char *aNew = sqlite3_realloc64(pWriter->aData, nReq);
23362336
if( !aNew ) return SQLITE_NOMEM;
23372337
pWriter->aData = aNew;
23382338
pWriter->nSize = nReq;
@@ -2357,7 +2357,7 @@ static int fts3SegWriterAdd(
23572357
*/
23582358
if( isCopyTerm ){
23592359
if( nTerm>pWriter->nMalloc ){
2360-
char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);
2360+
char *zNew = sqlite3_realloc64(pWriter->zMalloc, (i64)nTerm*2);
23612361
if( !zNew ){
23622362
return SQLITE_NOMEM;
23632363
}
@@ -2665,12 +2665,12 @@ static void fts3ColumnFilter(
26652665
static int fts3MsrBufferData(
26662666
Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
26672667
char *pList,
2668-
int nList
2668+
i64 nList
26692669
){
26702670
if( nList>pMsr->nBuffer ){
26712671
char *pNew;
26722672
pMsr->nBuffer = nList*2;
2673-
pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer);
2673+
pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
26742674
if( !pNew ) return SQLITE_NOMEM;
26752675
pMsr->aBuffer = pNew;
26762676
}
@@ -2726,7 +2726,7 @@ int sqlite3Fts3MsrIncrNext(
27262726
fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp);
27272727

27282728
if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){
2729-
rc = fts3MsrBufferData(pMsr, pList, nList+1);
2729+
rc = fts3MsrBufferData(pMsr, pList, (i64)nList+1);
27302730
if( rc!=SQLITE_OK ) return rc;
27312731
assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 );
27322732
pList = pMsr->aBuffer;
@@ -2863,11 +2863,11 @@ int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){
28632863
return SQLITE_OK;
28642864
}
28652865

2866-
static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, int nReq){
2866+
static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, i64 nReq){
28672867
if( nReq>pCsr->nBuffer ){
28682868
char *aNew;
28692869
pCsr->nBuffer = nReq*2;
2870-
aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);
2870+
aNew = sqlite3_realloc64(pCsr->aBuffer, pCsr->nBuffer);
28712871
if( !aNew ){
28722872
return SQLITE_NOMEM;
28732873
}
@@ -2958,7 +2958,8 @@ int sqlite3Fts3SegReaderStep(
29582958
){
29592959
pCsr->nDoclist = apSegment[0]->nDoclist;
29602960
if( fts3SegReaderIsPending(apSegment[0]) ){
2961-
rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist, pCsr->nDoclist);
2961+
rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist,
2962+
(i64)pCsr->nDoclist);
29622963
pCsr->aDoclist = pCsr->aBuffer;
29632964
}else{
29642965
pCsr->aDoclist = apSegment[0]->aDoclist;
@@ -3011,7 +3012,8 @@ int sqlite3Fts3SegReaderStep(
30113012

30123013
nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);
30133014

3014-
rc = fts3GrowSegReaderBuffer(pCsr, nByte+nDoclist+FTS3_NODE_PADDING);
3015+
rc = fts3GrowSegReaderBuffer(pCsr,
3016+
(i64)nByte+nDoclist+FTS3_NODE_PADDING);
30153017
if( rc ) return rc;
30163018

30173019
if( isFirst ){
@@ -3037,7 +3039,7 @@ int sqlite3Fts3SegReaderStep(
30373039
fts3SegReaderSort(apSegment, nMerge, j, xCmp);
30383040
}
30393041
if( nDoclist>0 ){
3040-
rc = fts3GrowSegReaderBuffer(pCsr, nDoclist+FTS3_NODE_PADDING);
3042+
rc = fts3GrowSegReaderBuffer(pCsr, (i64)nDoclist+FTS3_NODE_PADDING);
30413043
if( rc ) return rc;
30423044
memset(&pCsr->aBuffer[nDoclist], 0, FTS3_NODE_PADDING);
30433045
pCsr->aDoclist = pCsr->aBuffer;
@@ -3750,7 +3752,7 @@ struct NodeReader {
37503752
static void blobGrowBuffer(Blob *pBlob, int nMin, int *pRc){
37513753
if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){
37523754
int nAlloc = nMin;
3753-
char *a = (char *)sqlite3_realloc(pBlob->a, nAlloc);
3755+
char *a = (char *)sqlite3_realloc64(pBlob->a, nAlloc);
37543756
if( a ){
37553757
pBlob->nAlloc = nAlloc;
37563758
pBlob->a = a;
@@ -4547,7 +4549,7 @@ static int fts3RepackSegdirLevel(
45474549
if( nIdx>=nAlloc ){
45484550
int *aNew;
45494551
nAlloc += 16;
4550-
aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int));
4552+
aNew = sqlite3_realloc64(aIdx, nAlloc*sizeof(int));
45514553
if( !aNew ){
45524554
rc = SQLITE_NOMEM;
45534555
break;
@@ -4921,7 +4923,7 @@ int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){
49214923

49224924
/* Allocate space for the cursor, filter and writer objects */
49234925
const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter);
4924-
pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc);
4926+
pWriter = (IncrmergeWriter *)sqlite3_malloc64(nAlloc);
49254927
if( !pWriter ) return SQLITE_NOMEM;
49264928
pFilter = (Fts3SegFilter *)&pWriter[1];
49274929
pCsr = (Fts3MultiSegReader *)&pFilter[1];
@@ -5557,7 +5559,7 @@ int sqlite3Fts3DeferredTokenList(
55575559
return SQLITE_OK;
55585560
}
55595561

5560-
pRet = (char *)sqlite3_malloc(p->pList->nData);
5562+
pRet = (char *)sqlite3_malloc64(p->pList->nData);
55615563
if( !pRet ) return SQLITE_NOMEM;
55625564

55635565
nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy);
@@ -5577,7 +5579,7 @@ int sqlite3Fts3DeferToken(
55775579
int iCol /* Column that token must appear in (or -1) */
55785580
){
55795581
Fts3DeferredToken *pDeferred;
5580-
pDeferred = sqlite3_malloc(sizeof(*pDeferred));
5582+
pDeferred = sqlite3_malloc64(sizeof(*pDeferred));
55815583
if( !pDeferred ){
55825584
return SQLITE_NOMEM;
55835585
}

ext/icu/icu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,9 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){
299299

300300
if( U_SUCCESS(status) ){
301301
sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete);
302-
}else{
303-
assert(!pExpr);
302+
pExpr = sqlite3_get_auxdata(p, 0);
303+
}
304+
if( !pExpr ){
304305
icuFunctionError(p, "uregex_open", status);
305306
return;
306307
}

0 commit comments

Comments
 (0)