Skip to content

Commit 0927b5b

Browse files
committed
libsql-ffi: Update sqlite3mc bundle
1 parent 199a1ac commit 0927b5b

File tree

2 files changed

+648
-55
lines changed

2 files changed

+648
-55
lines changed

libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@
2828
** README.md
2929
** configure
3030
** configure.ac
31+
** doc/compile-for-windows.md
32+
** doc/jsonb.md
33+
** doc/testrunner.md
34+
** doc/trusted-schema.md
35+
** doc/vdbesort-memory.md
36+
** doc/wal-lock.md
3137
** ext/fts5/fts5_tokenize.c
38+
** ext/jni/README.md
3239
** ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java
3340
** ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java
3441
** ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java
@@ -81,38 +88,9 @@
8188
** src/where.c
8289
** src/wherecode.c
8390
** test/all.test
84-
** test/dbdata.test
85-
** test/dbfuzz.c
86-
** test/dbfuzz001.test
87-
** test/dbfuzz2-seed1.db
88-
** test/dbfuzz2.c
89-
** test/dbpage.test
90-
** test/dbpagefault.test
91-
** test/dbstatus.test
92-
** test/dbstatus2.test
93-
** test/delete_db.test
94-
** test/fuzzdata1.db
95-
** test/fuzzdata2.db
96-
** test/fuzzdata3.db
97-
** test/fuzzdata4.db
98-
** test/fuzzdata5.db
99-
** test/fuzzdata6.db
100-
** test/fuzzdata7.db
101-
** test/fuzzdata8.db
102-
** test/indexedby.test
103-
** test/manydb.test
104-
** test/memdb.test
105-
** test/memdb1.test
106-
** test/memdb2.test
107-
** test/optfuzz-db01.c
108-
** test/optfuzz-db01.txt
91+
** test/json/README.md
10992
** test/permutations.test
110-
** test/resetdb.test
11193
** test/rowvaluevtab.test
112-
** test/sessionfuzz-data1.db
113-
** test/tempdb.test
114-
** test/tempdb2.test
115-
** test/tkt-94c04eaadb.test
11694
** tool/mkkeywordhash.c
11795
** tool/mksqlite3c-noext.tcl
11896
** tool/mksqlite3c.tcl
@@ -65386,18 +65364,25 @@ SQLITE_PRIVATE int sqlite3PagerWalInsert(Pager *pPager, unsigned int iFrame, voi
6538665364
}
6538765365
if (iFrame <= mxFrame) {
6538865366
unsigned long frame_len = nBuf-24;
65389-
unsigned char current[frame_len];
65367+
unsigned char *current;
65368+
65369+
current = (unsigned char *)sqlite3MallocZero(frame_len);
65370+
if (current == NULL) {
65371+
return SQLITE_NOMEM;
65372+
}
6539065373
rc = pPager->wal->methods.xReadFrame(pPager->wal->pData, iFrame, frame_len, current);
6539165374
if (rc != SQLITE_OK) {
65375+
sqlite3_free(current);
6539265376
return rc;
6539365377
}
6539465378
int conflict = 0;
65395-
if (memcmp(pBuf+24, current, frame_len) != 0) {
65379+
if (memcmp((unsigned char*)pBuf+24, current, frame_len) != 0) {
6539665380
conflict = 1;
6539765381
}
6539865382
if (pConflict) {
6539965383
*pConflict = conflict;
6540065384
}
65385+
sqlite3_free(current);
6540165386
if (conflict) {
6540265387
return SQLITE_ERROR;
6540365388
}
@@ -67628,6 +67613,15 @@ static int walCheckpoint(
6762867613
}
6762967614
}
6763067615

67616+
67617+
#ifdef LIBSQL_CHECKPOINT_ONLY_FULL
67618+
// in case of LIBSQL_CHECKPOINT_ONLY_FULL option we want to either checkpoint whole WAL or quickly abort the checkpoint
67619+
if( mxSafeFrame!=walIndexHdr(pWal)->mxFrame ){
67620+
rc = SQLITE_BUSY;
67621+
goto walcheckpoint_out;
67622+
}
67623+
#endif
67624+
6763167625
/* Allocate the iterator */
6763267626
if( pInfo->nBackfill<mxSafeFrame ){
6763367627
rc = walIteratorRevInit(pWal, pInfo->nBackfill, &pIter, mxSafeFrame, xCb == NULL);
@@ -121878,6 +121872,10 @@ SQLITE_PRIVATE int sqlite3DbIsNamed(sqlite3 *db, int iDb, const char *zName){
121878121872
int libsql_handle_extra_attach_params(sqlite3* db, const char* zName, const char* zPath, sqlite3_value* pKey, char** zErrDyn);
121879121873
#endif
121880121874

121875+
#ifdef LIBSQL_ENCRYPTION
121876+
SQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3*, const char*, const char*, sqlite3_value*, char**);
121877+
#endif
121878+
121881121879
/*
121882121880
** An SQL user-function registered to do the work of an ATTACH statement. The
121883121881
** three arguments to the function come directly from an attach statement:
@@ -122037,6 +122035,16 @@ static void attachFunc(
122037122035
rc = libsql_handle_extra_attach_params(db, zName, zPath, argv, &zErrDyn);
122038122036
}
122039122037
#endif
122038+
122039+
#ifdef LIBSQL_ENCRYPTION
122040+
/* If the ATTACH statement came with key parameter, then lets handle it here. */
122041+
if( rc==SQLITE_OK ){
122042+
if( argv != NULL && argv[0] != NULL && argv[1] != NULL && argv[2] != NULL ){
122043+
rc = sqlite3mcHandleAttachKey(db, zName, zPath, argv[2], &zErrDyn);
122044+
}
122045+
}
122046+
#endif
122047+
122040122048
sqlite3_free_filename( zPath );
122041122049

122042122050
/* If the file was opened successfully, read the schema for the new database.

0 commit comments

Comments
 (0)