Skip to content

Commit de5c6b1

Browse files
committed
fix(sqlite): import release 3.50.4
SQLite Release 3.50.4 On 2025-07-30 1. Fix two long-standings cases of the use of uninitialized variables in obscure circumstances.
1 parent 0267d65 commit de5c6b1

File tree

4 files changed

+50
-19
lines changed

4 files changed

+50
-19
lines changed

source/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## SQLite Release 3.50.4 On 2025-07-30
4+
5+
1. Fix two long-standings cases of the use of uninitialized variables in obscure circumstances.
6+
37
## SQLite Release 3.50.3 On 2025-07-17
48

59
1. Fix a possible memory error that can occur if a query is made against against FTS5 index that has been deliberately corrupted in a very specific way.

source/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
Download: https://sqlite.org/2025/sqlite-amalgamation-3500300.zip
1+
Download: https://sqlite.org/2025/sqlite-amalgamation-3500400.zip
22

33
```
4-
Archive: sqlite-amalgamation-3500300.zip
4+
Archive: sqlite-amalgamation-3500400.zip
55
Length Method Size Cmpr Date Time CRC-32 Name
66
-------- ------ ------- ---- ---------- ----- -------- ----
7-
0 Stored 0 0% 2025-07-17 15:33 00000000 sqlite-amalgamation-3500300/
8-
9281911 Defl:N 2393667 74% 2025-07-17 15:33 1b8efdec sqlite-amalgamation-3500300/sqlite3.c
9-
1066685 Defl:N 273051 74% 2025-07-17 15:33 42b0b5f6 sqlite-amalgamation-3500300/shell.c
10-
661968 Defl:N 171059 74% 2025-07-17 15:33 6cf211ed sqlite-amalgamation-3500300/sqlite3.h
11-
38321 Defl:N 6640 83% 2025-07-17 15:33 50ad28b2 sqlite-amalgamation-3500300/sqlite3ext.h
7+
0 Stored 0 0% 2025-07-30 21:45 00000000 sqlite-amalgamation-3500400/
8+
9282866 Defl:N 2393950 74% 2025-07-30 21:45 054fd04e sqlite-amalgamation-3500400/sqlite3.c
9+
1066685 Defl:N 273051 74% 2025-07-30 21:45 42b0b5f6 sqlite-amalgamation-3500400/shell.c
10+
661968 Defl:N 171059 74% 2025-07-30 21:45 8f16f2ad sqlite-amalgamation-3500400/sqlite3.h
11+
38321 Defl:N 6640 83% 2025-07-30 21:45 50ad28b2 sqlite-amalgamation-3500400/sqlite3ext.h
1212
-------- ------- --- -------
13-
11048885 2844417 74% 5 files
13+
11049840 2844700 74% 5 files
1414
```

source/sqlite3.c

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3-
** version 3.50.3. By combining all the individual C code files into this
3+
** version 3.50.4. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
@@ -18,7 +18,7 @@
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21-
** 3ce993b8657d6d9deda380a93cdd6404a8c8 with changes in files:
21+
** 4d8adfb30e03f9cf27f800a2c1ba3c48fb4c with changes in files:
2222
**
2323
**
2424
*/
@@ -465,9 +465,9 @@ extern "C" {
465465
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466466
** [sqlite_version()] and [sqlite_source_id()].
467467
*/
468-
#define SQLITE_VERSION "3.50.3"
469-
#define SQLITE_VERSION_NUMBER 3050003
470-
#define SQLITE_SOURCE_ID "2025-07-17 13:25:10 3ce993b8657d6d9deda380a93cdd6404a8c8ba1b185b2bc423703e41ae5f2543"
468+
#define SQLITE_VERSION "3.50.4"
469+
#define SQLITE_VERSION_NUMBER 3050004
470+
#define SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3"
471471

472472
/*
473473
** CAPI3REF: Run-Time Library Version Numbers
@@ -19440,6 +19440,7 @@ struct Expr {
1944019440
Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
1944119441
** for a column of an index on an expression */
1944219442
Window *pWin; /* EP_WinFunc: Window/Filter defn for a function */
19443+
int nReg; /* TK_NULLS: Number of registers to NULL out */
1944319444
struct { /* TK_IN, TK_SELECT, and TK_EXISTS */
1944419445
int iAddr; /* Subroutine entry address */
1944519446
int regReturn; /* Register used to hold return address */
@@ -21474,6 +21475,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn(Parse*, Table*, Column*, int)
2147421475
SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int);
2147521476
SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
2147621477
SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce(Parse*, Expr*, int);
21478+
SQLITE_PRIVATE void sqlite3ExprNullRegisterRange(Parse*, int, int);
2147721479
SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
2147821480
SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);
2147921481
SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int, u8);
@@ -115241,6 +115243,12 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
115241115243
sqlite3VdbeLoadString(v, target, pExpr->u.zToken);
115242115244
return target;
115243115245
}
115246+
case TK_NULLS: {
115247+
/* Set a range of registers to NULL. pExpr->y.nReg registers starting
115248+
** with target */
115249+
sqlite3VdbeAddOp3(v, OP_Null, 0, target, target + pExpr->y.nReg - 1);
115250+
return target;
115251+
}
115244115252
default: {
115245115253
/* Make NULL the default case so that if a bug causes an illegal
115246115254
** Expr node to be passed into this function, it will be handled
@@ -115925,6 +115933,25 @@ SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce(
115925115933
return regDest;
115926115934
}
115927115935

115936+
/*
115937+
** Make arrangements to invoke OP_Null on a range of registers
115938+
** during initialization.
115939+
*/
115940+
SQLITE_PRIVATE SQLITE_NOINLINE void sqlite3ExprNullRegisterRange(
115941+
Parse *pParse, /* Parsing context */
115942+
int iReg, /* First register to set to NULL */
115943+
int nReg /* Number of sequential registers to NULL out */
115944+
){
115945+
u8 okConstFactor = pParse->okConstFactor;
115946+
Expr t;
115947+
memset(&t, 0, sizeof(t));
115948+
t.op = TK_NULLS;
115949+
t.y.nReg = nReg;
115950+
pParse->okConstFactor = 1;
115951+
sqlite3ExprCodeRunJustOnce(pParse, &t, iReg);
115952+
pParse->okConstFactor = okConstFactor;
115953+
}
115954+
115928115955
/*
115929115956
** Generate code to evaluate an expression and store the results
115930115957
** into a register. Return the register number where the results
@@ -153175,6 +153202,7 @@ SQLITE_PRIVATE int sqlite3Select(
153175153202
sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag);
153176153203
VdbeComment((v, "clear abort flag"));
153177153204
sqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1);
153205+
sqlite3ExprNullRegisterRange(pParse, iAMem, pGroupBy->nExpr);
153178153206

153179153207
/* Begin a loop that will extract all source rows in GROUP BY order.
153180153208
** This might involve two separate loops with an OP_Sort in between, or
@@ -168470,6 +168498,7 @@ static int whereLoopAddBtree(
168470168498
pNew->u.btree.nEq = 0;
168471168499
pNew->u.btree.nBtm = 0;
168472168500
pNew->u.btree.nTop = 0;
168501+
pNew->u.btree.nDistinctCol = 0;
168473168502
pNew->nSkip = 0;
168474168503
pNew->nLTerm = 0;
168475168504
pNew->iSortIdx = 0;
@@ -169538,8 +169567,6 @@ static i8 wherePathSatisfiesOrderBy(
169538169567
obSat = obDone;
169539169568
}
169540169569
break;
169541-
}else if( wctrlFlags & WHERE_DISTINCTBY ){
169542-
pLoop->u.btree.nDistinctCol = 0;
169543169570
}
169544169571
iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor;
169545169572

@@ -257280,7 +257307,7 @@ static void fts5SourceIdFunc(
257280257307
){
257281257308
assert( nArg==0 );
257282257309
UNUSED_PARAM2(nArg, apUnused);
257283-
sqlite3_result_text(pCtx, "fts5: 2025-07-17 13:25:10 3ce993b8657d6d9deda380a93cdd6404a8c8ba1b185b2bc423703e41ae5f2543", -1, SQLITE_TRANSIENT);
257310+
sqlite3_result_text(pCtx, "fts5: 2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3", -1, SQLITE_TRANSIENT);
257284257311
}
257285257312

257286257313
/*

source/sqlite3.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ extern "C" {
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149-
#define SQLITE_VERSION "3.50.3"
150-
#define SQLITE_VERSION_NUMBER 3050003
151-
#define SQLITE_SOURCE_ID "2025-07-17 13:25:10 3ce993b8657d6d9deda380a93cdd6404a8c8ba1b185b2bc423703e41ae5f2543"
149+
#define SQLITE_VERSION "3.50.4"
150+
#define SQLITE_VERSION_NUMBER 3050004
151+
#define SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3"
152152

153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers

0 commit comments

Comments
 (0)