Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Update Android.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
grendello committed Mar 28, 2022
1 parent 33f79fb commit 7b1e016
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions dist/Android.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
--- orig/shell.c 2020-07-09 13:55:18.598783417 +0100
+++ shell.c 2020-10-06 00:01:10.631859326 +0100
@@ -95,6 +95,11 @@
diff --git a/dist/shell.c b/dist/shell.c
index 3df2bf2..3aed6e3 100644
--- a/dist/shell.c
+++ b/dist/shell.c
@@ -107,6 +107,11 @@ typedef unsigned char u8;
#endif
#include <ctype.h>
#include <stdarg.h>
Expand All @@ -12,7 +14,7 @@

#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
@@ -12957,6 +12962,22 @@
@@ -16104,6 +16109,22 @@ static void open_db(ShellState *p, int openFlags){
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
editFunc, 0, 0);
#endif
Expand All @@ -34,10 +36,12 @@
+
if( p->openMode==SHELL_OPEN_ZIPFILE ){
char *zSql = sqlite3_mprintf(
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", p->zDbFilename);
--- orig/sqlite3.c 2020-07-09 13:55:18.706784068 +0100
+++ sqlite3.c 2020-07-09 13:55:18.814784719 +0100
@@ -33395,6 +33395,10 @@
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
index 0b227f0..68da513 100644
--- a/dist/sqlite3.c
+++ b/dist/sqlite3.c
@@ -34924,6 +34924,10 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
# include <sys/mount.h>
#endif

Expand All @@ -48,7 +52,7 @@
#ifdef HAVE_UTIME
# include <utime.h>
#endif
@@ -34155,6 +34159,12 @@
@@ -35486,6 +35490,12 @@ static int robust_open(const char *z, int f, mode_t m){
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
#endif
Expand All @@ -61,7 +65,7 @@
}
return fd;
}
@@ -34735,7 +34745,13 @@
@@ -36066,7 +36076,13 @@ static int unixLogErrorAtLine(
** and move on.
*/
static void robust_close(unixFile *pFile, int h, int lineno){
Expand All @@ -75,7 +79,7 @@
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
pFile ? pFile->zPath : 0, lineno);
}
@@ -37269,7 +37285,7 @@
@@ -38621,7 +38637,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
SimulateIOError( rc=1 );
if( rc!=0 ){
storeLastErrno((unixFile*)id, errno);
Expand All @@ -84,16 +88,16 @@
}
*pSize = buf.st_size;

@@ -37305,7 +37321,7 @@
@@ -38657,7 +38673,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
struct stat buf; /* Used to hold return values of fstat() */

if( osFstat(pFile->h, &buf) ){
- return SQLITE_IOERR_FSTAT;
+ return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
}

nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -38000,7 +38016,7 @@
@@ -39399,7 +39415,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
** with the same permissions.
*/
if( osFstat(pDbFd->h, &sStat) ){
Expand All @@ -102,7 +106,7 @@
goto shm_open_err;
}

@@ -128218,7 +128234,7 @@
@@ -133505,7 +133521,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
}
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
sqlite3SetString(pzErrMsg, db, "unsupported file format");
Expand All @@ -111,12 +115,12 @@
goto initone_error_out;
}

@@ -170128,13 +170144,25 @@
@@ -178684,13 +178700,25 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
** module with sqlite.
*/
if( SQLITE_OK==rc
if( SQLITE_OK==rc
+#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
&& SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
+#endif
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
Expand All @@ -134,6 +138,6 @@
+ );
+ if(rc) return rc;
+#endif
pHash->nRef++;
rc = sqlite3_create_module_v2(
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
);

0 comments on commit 7b1e016

Please sign in to comment.