diff --git a/sqlite-2.8.17-CVE-2007-1888.patch b/sqlite-2.8.17-CVE-2007-1888.patch new file mode 100644 index 0000000..b53cde3 --- /dev/null +++ b/sqlite-2.8.17-CVE-2007-1888.patch @@ -0,0 +1,13 @@ +diff -up sqlite-2.8.17/src/encode.c.CVE-2007-1888 sqlite-2.8.17/src/encode.c +--- sqlite-2.8.17/src/encode.c.CVE-2007-1888 2019-04-10 14:51:32.854203706 -0400 ++++ sqlite-2.8.17/src/encode.c 2019-04-10 14:52:34.692952419 -0400 +@@ -176,6 +176,9 @@ int sqlite_decode_binary(const unsigned + int i, e; + unsigned char c; + e = *(in++); ++ if( e==0 ){ ++ return 0; ++ } + i = 0; + while( (c = *(in++))!=0 ){ + if( c==1 ){ diff --git a/sqlite-2.8.17-cleanup-temp-c.patch b/sqlite-2.8.17-cleanup-temp-c.patch new file mode 100644 index 0000000..f6891e8 --- /dev/null +++ b/sqlite-2.8.17-cleanup-temp-c.patch @@ -0,0 +1,14 @@ +diff -up sqlite-2.8.17/Makefile.in.cleanup-tempc sqlite-2.8.17/Makefile.in +--- sqlite-2.8.17/Makefile.in.cleanup-tempc 2019-04-10 14:45:24.990212962 -0400 ++++ sqlite-2.8.17/Makefile.in 2019-04-10 14:46:21.140254699 -0400 +@@ -270,8 +270,9 @@ parse.c: $(TOP)/src/parse.y lemon@BUILD_ + # + config.h: + echo '#include ' >temp.c ++ echo '#include '>>temp.c + echo 'int main(){printf(' >>temp.c +- echo '"#define SQLITE_PTR_SZ %d",sizeof(char*));' >>temp.c ++ echo '"#define SQLITE_PTR_SZ %ld",sizeof(char*));' >>temp.c + echo 'exit(0);}' >>temp.c + $(BCC) -o temp temp.c + ./temp >config.h diff --git a/sqlite-2.8.17-fix-sort-syntax.patch b/sqlite-2.8.17-fix-sort-syntax.patch new file mode 100644 index 0000000..ecb7787 --- /dev/null +++ b/sqlite-2.8.17-fix-sort-syntax.patch @@ -0,0 +1,12 @@ +diff -up sqlite-2.8.17/Makefile.in.fix-sort-syntax sqlite-2.8.17/Makefile.in +--- sqlite-2.8.17/Makefile.in.fix-sort-syntax 2019-04-10 15:00:15.804634056 -0400 ++++ sqlite-2.8.17/Makefile.in 2019-04-10 15:00:26.075425567 -0400 +@@ -184,7 +184,7 @@ Makefile: $(TOP)/Makefile.in + # of the most recently modified source code file + # + last_change: $(SRC) +- cat $(SRC) | grep '$$Id: ' | sort +4 | tail -n 1 \ ++ cat $(SRC) | grep '$$Id: ' | sort -k 4 | tail -n 1 \ + | awk '{print $$5,$$6}' >last_change + + libsqlite.la: $(LIBOBJ) diff --git a/sqlite-2.8.17-fix-unsigned-FTBFS.patch b/sqlite-2.8.17-fix-unsigned-FTBFS.patch new file mode 100644 index 0000000..49c1120 --- /dev/null +++ b/sqlite-2.8.17-fix-unsigned-FTBFS.patch @@ -0,0 +1,12 @@ +diff -up sqlite-2.8.17/tool/lemon.c.crashfix sqlite-2.8.17/tool/lemon.c +--- sqlite-2.8.17/tool/lemon.c.crashfix 2019-04-10 15:03:23.464811085 -0400 ++++ sqlite-2.8.17/tool/lemon.c 2019-04-10 15:04:02.767018417 -0400 +@@ -3018,7 +3018,7 @@ int mhflag; /* True if g + int maxdtlength; /* Maximum length of any ".datatype" field. */ + char *stddt; /* Standardized name for a datatype */ + int i,j; /* Loop counters */ +- int hash; /* For hashing the name of a type */ ++ unsigned int hash; /* For hashing the name of a type */ + char *name; /* Name of the parser */ + + /* Allocate and initialize types[] and allocate stddt[] */ diff --git a/sqlite-2.8.17-ldflags.patch b/sqlite-2.8.17-ldflags.patch new file mode 100644 index 0000000..b8c2531 --- /dev/null +++ b/sqlite-2.8.17-ldflags.patch @@ -0,0 +1,12 @@ +diff -up sqlite-2.8.17/Makefile.in.ldflags sqlite-2.8.17/Makefile.in +--- sqlite-2.8.17/Makefile.in.ldflags 2019-04-10 15:01:39.401934112 -0400 ++++ sqlite-2.8.17/Makefile.in 2019-04-10 15:01:48.856740555 -0400 +@@ -38,7 +38,7 @@ RELEASE = @ALLOWRELEASE@ + + # libtool compile/link/install + LTCOMPILE = $(LIBTOOL) --mode=compile $(TCC) +-LTLINK = $(LIBTOOL) --mode=link $(TCC) ++LTLINK = $(LIBTOOL) --mode=link $(TCC) $(LDFLAGS) + LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL) + + # Compiler options needed for programs that use the TCL library. diff --git a/sqlite-2.8.17-lemon-snprintf.patch b/sqlite-2.8.17-lemon-snprintf.patch new file mode 100644 index 0000000..cf41916 --- /dev/null +++ b/sqlite-2.8.17-lemon-snprintf.patch @@ -0,0 +1,77 @@ +diff -up sqlite-2.8.17/tool/lemon.c.snprintf sqlite-2.8.17/tool/lemon.c +--- sqlite-2.8.17/tool/lemon.c.snprintf 2019-04-10 14:54:06.947117428 -0400 ++++ sqlite-2.8.17/tool/lemon.c 2019-04-10 14:58:20.765967958 -0400 +@@ -1272,15 +1272,15 @@ void ErrorMsg(const char *filename, int + va_start(ap, format); + /* Prepare a prefix to be prepended to every output line */ + if( lineno>0 ){ +- sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); ++ snprintf(prefix,sizeof prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); + }else{ +- sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); ++ snprintf(prefix,sizeof prefix,"%.*s: ",PREFIXLIMIT-10,filename); + } + prefixsize = strlen(prefix); + availablewidth = LINEWIDTH - prefixsize; + + /* Generate the error message */ +- vsprintf(errmsg,format,ap); ++ vsnprintf(errmsg,sizeof errmsg,format,ap); + va_end(ap); + errmsgsize = strlen(errmsg); + /* Remove trailing '\n's from the error message. */ +@@ -2675,7 +2675,7 @@ struct lemon *lemp; + while( cfp ){ + char buf[20]; + if( cfp->dot==cfp->rp->nrhs ){ +- sprintf(buf,"(%d)",cfp->rp->index); ++ snprintf(buf,sizeof buf,"(%d)",cfp->rp->index); + fprintf(fp," %5s ",buf); + }else{ + fprintf(fp," "); +@@ -2814,14 +2814,16 @@ struct lemon *lemp; + + cp = strrchr(lemp->filename,'.'); + if( cp ){ +- sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); ++ snprintf(buf,sizeof buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); + }else{ +- sprintf(buf,"%s.lt",lemp->filename); ++ snprintf(buf,sizeof buf,"%s.lt",lemp->filename); + } + if( access(buf,004)==0 ){ + tpltname = buf; + }else if( access(templatename,004)==0 ){ + tpltname = templatename; ++ }else if( access("/usr/share/lemon/lempar.c",004)==0 ){ ++ tpltname = "/usr/share/lemon/lempar.c"; + }else{ + tpltname = pathsearch(lemp->argv0,templatename,0); + } +@@ -2833,7 +2835,7 @@ struct lemon *lemp; + } + in = fopen(tpltname,"r"); + if( in==0 ){ +- fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); ++ fprintf(stderr,"Can't open the template file \"%s\".\n",tpltname); + lemp->errorcnt++; + return 0; + } +@@ -3447,7 +3449,7 @@ int mhflag; /* Output in makeheaders + /* Generate a table containing the symbolic name of every symbol + */ + for(i=0; insymbol; i++){ +- sprintf(line,"\"%s\",",lemp->symbols[i]->name); ++ snprintf(line,sizeof line,"\"%s\",",lemp->symbols[i]->name); + fprintf(out," %-15s",line); + if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } + } +@@ -3562,7 +3564,7 @@ struct lemon *lemp; + in = file_open(lemp,".h","r"); + if( in ){ + for(i=1; interminal && fgets(line,LINESIZE,in); i++){ +- sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); ++ snprintf(pattern,sizeof pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); + if( strcmp(line,pattern) ) break; + } + fclose(in); diff --git a/sqlite-2.8.17-suse-cleanups.patch b/sqlite-2.8.17-suse-cleanups.patch new file mode 100644 index 0000000..28b4ddb --- /dev/null +++ b/sqlite-2.8.17-suse-cleanups.patch @@ -0,0 +1,292 @@ +diff -up sqlite-2.8.17/main.mk.suse sqlite-2.8.17/main.mk +--- sqlite-2.8.17/main.mk.suse 2019-04-10 13:58:27.732431498 -0400 ++++ sqlite-2.8.17/main.mk 2019-04-10 13:58:44.004100000 -0400 +@@ -145,7 +145,7 @@ all: sqlite.h config.h libsqlite.a sqlit + # of the most recently modified source code file + # + last_change: $(SRC) +- cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \ ++ cat $(SRC) | grep '$$Id: ' | sort +4 | tail -n 1 \ + | awk '{print $$5,$$6}' >last_change + + libsqlite.a: $(LIBOBJ) +diff -up sqlite-2.8.17/Makefile.in.suse sqlite-2.8.17/Makefile.in +--- sqlite-2.8.17/Makefile.in.suse 2019-04-10 13:56:27.446882088 -0400 ++++ sqlite-2.8.17/Makefile.in 2019-04-10 13:58:22.316541835 -0400 +@@ -26,7 +26,7 @@ BCC = @BUILD_CC@ @BUILD_CFLAGS@ + # will run on the target platform. (BCC and TCC are usually the + # same unless your are cross-compiling.) + # +-TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src ++TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src -DTHREADSAFE=1 + + # Some standard variables and programs + # +@@ -184,7 +184,7 @@ Makefile: $(TOP)/Makefile.in + # of the most recently modified source code file + # + last_change: $(SRC) +- cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \ ++ cat $(SRC) | grep '$$Id: ' | sort +4 | tail -n 1 \ + | awk '{print $$5,$$6}' >last_change + + libsqlite.la: $(LIBOBJ) +@@ -365,7 +365,7 @@ tclsqlite: tclsqlite-sh.lo libsqlite.la + testfixture@TARGET_EXEEXT@: $(TOP)/src/tclsqlite.c libtclsqlite.la libsqlite.la $(TESTSRC) + $(LTLINK) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1\ + -o testfixture $(TESTSRC) $(TOP)/src/tclsqlite.c \ +- libtclsqlite.la libsqlite.la $(LIBTCL) ++ libtclsqlite.la libsqlite.la $(LIBTCL) -lpthread + + fulltest: testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@ + ./testfixture $(TOP)/test/all.test +diff -up sqlite-2.8.17/src/attach.c.suse sqlite-2.8.17/src/attach.c +--- sqlite-2.8.17/src/attach.c.suse 2019-04-10 13:58:52.066935738 -0400 ++++ sqlite-2.8.17/src/attach.c 2019-04-10 13:59:35.179057409 -0400 +@@ -48,7 +48,7 @@ void sqliteAttach(Parse *pParse, Token * + } + + zFile = 0; +- sqliteSetNString(&zFile, pFilename->z, pFilename->n, 0); ++ sqliteSetNString(&zFile, pFilename->z, pFilename->n, (char*)0); + if( zFile==0 ) return; + sqliteDequote(zFile); + #ifndef SQLITE_OMIT_AUTHORIZATION +@@ -59,7 +59,7 @@ void sqliteAttach(Parse *pParse, Token * + #endif /* SQLITE_OMIT_AUTHORIZATION */ + + zName = 0; +- sqliteSetNString(&zName, pDbname->z, pDbname->n, 0); ++ sqliteSetNString(&zName, pDbname->z, pDbname->n, (char*)0); + if( zName==0 ) return; + sqliteDequote(zName); + for(i=0; inDb; i++){ +diff -up sqlite-2.8.17/src/build.c.suse sqlite-2.8.17/src/build.c +--- sqlite-2.8.17/src/build.c.suse 2019-04-10 13:59:41.010938595 -0400 ++++ sqlite-2.8.17/src/build.c 2019-04-10 14:01:24.312835795 -0400 +@@ -559,7 +559,7 @@ void sqliteAddColumn(Parse *pParse, Toke + char *z = 0; + Column *pCol; + if( (p = pParse->pNewTable)==0 ) return; +- sqliteSetNString(&z, pName->z, pName->n, 0); ++ sqliteSetNString(&z, pName->z, pName->n, (char*)0); + if( z==0 ) return; + sqliteDequote(z); + for(i=0; inCol; i++){ +@@ -617,7 +617,7 @@ void sqliteAddColumnType(Parse *pParse, + pCol = &p->aCol[i]; + pz = &pCol->zType; + n = pLast->n + Addr(pLast->z) - Addr(pFirst->z); +- sqliteSetNString(pz, pFirst->z, n, 0); ++ sqliteSetNString(pz, pFirst->z, n, (char*)0); + z = *pz; + if( z==0 ) return; + for(i=j=0; z[i]; i++){ +@@ -650,9 +650,9 @@ void sqliteAddDefaultValue(Parse *pParse + if( i<0 ) return; + pz = &p->aCol[i].zDflt; + if( minusFlag ){ +- sqliteSetNString(pz, "-", 1, pVal->z, pVal->n, 0); ++ sqliteSetNString(pz, "-", 1, pVal->z, pVal->n, (char*)0); + }else{ +- sqliteSetNString(pz, pVal->z, pVal->n, 0); ++ sqliteSetNString(pz, pVal->z, pVal->n, (char*)0); + } + sqliteDequote(*pz); + } +@@ -1856,7 +1856,7 @@ IdList *sqliteIdListAppend(IdList *pList + memset(&pList->a[pList->nId], 0, sizeof(pList->a[0])); + if( pToken ){ + char **pz = &pList->a[pList->nId].zName; +- sqliteSetNString(pz, pToken->z, pToken->n, 0); ++ sqliteSetNString(pz, pToken->z, pToken->n, (char*)0); + if( *pz==0 ){ + sqliteIdListDelete(pList); + return 0; +@@ -1921,7 +1921,7 @@ SrcList *sqliteSrcListAppend(SrcList *pL + } + if( pTable ){ + char **pz = &pList->a[pList->nSrc].zName; +- sqliteSetNString(pz, pTable->z, pTable->n, 0); ++ sqliteSetNString(pz, pTable->z, pTable->n, (char*)0); + if( *pz==0 ){ + sqliteSrcListDelete(pList); + return 0; +@@ -1931,7 +1931,7 @@ SrcList *sqliteSrcListAppend(SrcList *pL + } + if( pDatabase ){ + char **pz = &pList->a[pList->nSrc].zDatabase; +- sqliteSetNString(pz, pDatabase->z, pDatabase->n, 0); ++ sqliteSetNString(pz, pDatabase->z, pDatabase->n, (char*)0); + if( *pz==0 ){ + sqliteSrcListDelete(pList); + return 0; +@@ -1962,7 +1962,7 @@ void sqliteSrcListAssignCursors(Parse *p + void sqliteSrcListAddAlias(SrcList *pList, Token *pToken){ + if( pList && pList->nSrc>0 ){ + int i = pList->nSrc - 1; +- sqliteSetNString(&pList->a[i].zAlias, pToken->z, pToken->n, 0); ++ sqliteSetNString(&pList->a[i].zAlias, pToken->z, pToken->n, (char*)0); + sqliteDequote(pList->a[i].zAlias); + } + } +diff -up sqlite-2.8.17/src/expr.c.suse sqlite-2.8.17/src/expr.c +--- sqlite-2.8.17/src/expr.c.suse 2019-04-10 14:30:57.775728582 -0400 ++++ sqlite-2.8.17/src/expr.c 2019-04-10 14:31:15.127321739 -0400 +@@ -269,7 +269,7 @@ ExprList *sqliteExprListAppend(ExprList + memset(pItem, 0, sizeof(*pItem)); + pItem->pExpr = pExpr; + if( pName ){ +- sqliteSetNString(&pItem->zName, pName->z, pName->n, 0); ++ sqliteSetNString(&pItem->zName, pName->z, pName->n, (char*)0); + sqliteDequote(pItem->zName); + } + } +diff -up sqlite-2.8.17/src/pragma.c.suse sqlite-2.8.17/src/pragma.c +--- sqlite-2.8.17/src/pragma.c.suse 2019-04-10 14:31:21.335176252 -0400 ++++ sqlite-2.8.17/src/pragma.c 2019-04-10 14:31:38.126782727 -0400 +@@ -167,7 +167,7 @@ void sqlitePragma(Parse *pParse, Token * + sqliteDequote(zLeft); + if( minusFlag ){ + zRight = 0; +- sqliteSetNString(&zRight, "-", 1, pRight->z, pRight->n, 0); ++ sqliteSetNString(&zRight, "-", 1, pRight->z, pRight->n, (char*)0); + }else{ + zRight = sqliteStrNDup(pRight->z, pRight->n); + sqliteDequote(zRight); +diff -up sqlite-2.8.17/src/printf.c.suse sqlite-2.8.17/src/printf.c +--- sqlite-2.8.17/src/printf.c.suse 2019-04-10 14:31:45.198616993 -0400 ++++ sqlite-2.8.17/src/printf.c 2019-04-10 14:33:50.164555108 -0400 +@@ -647,7 +647,7 @@ struct sgMprintf { + int nChar; /* Length of the string so far */ + int nTotal; /* Output size if unconstrained */ + int nAlloc; /* Amount of space allocated in zText */ +- void *(*xRealloc)(void*,int); /* Function used to realloc memory */ ++ void *(*xRealloc)(void*,size_t); /* Function used to realloc memory */ + }; + + /* +@@ -688,7 +688,7 @@ static void mout(void *arg, const char * + ** the consumer. + */ + static char *base_vprintf( +- void *(*xRealloc)(void*,int), /* Routine to realloc memory. May be NULL */ ++ void *(*xRealloc)(void*,size_t), /* Routine to realloc memory. May be NULL */ + int useInternal, /* Use internal %-conversions if true */ + char *zInitBuf, /* Initially write here, before mallocing */ + int nInitBuf, /* Size of zInitBuf[] */ +@@ -715,7 +715,7 @@ static char *base_vprintf( + /* + ** Realloc that is a real function, not a macro. + */ +-static void *printf_realloc(void *old, int size){ ++static void *printf_realloc(void *old, size_t size){ + return sqliteRealloc(old,size); + } + +@@ -752,8 +752,7 @@ char *sqlite_mprintf(const char *zFormat + char zBuf[200]; + + va_start(ap,zFormat); +- z = base_vprintf((void*(*)(void*,int))realloc, 0, +- zBuf, sizeof(zBuf), zFormat, ap); ++ z = base_vprintf(realloc, 0, zBuf, sizeof(zBuf), zFormat, ap); + va_end(ap); + return z; + } +@@ -762,8 +761,7 @@ char *sqlite_mprintf(const char *zFormat + */ + char *sqlite_vmprintf(const char *zFormat, va_list ap){ + char zBuf[200]; +- return base_vprintf((void*(*)(void*,int))realloc, 0, +- zBuf, sizeof(zBuf), zFormat, ap); ++ return base_vprintf(realloc, 0, zBuf, sizeof(zBuf), zFormat, ap); + } + + /* +diff -up sqlite-2.8.17/src/select.c.suse sqlite-2.8.17/src/select.c +--- sqlite-2.8.17/src/select.c.suse 2019-04-10 14:33:55.340435617 -0400 ++++ sqlite-2.8.17/src/select.c 2019-04-10 14:35:16.170605054 -0400 +@@ -121,7 +121,7 @@ int sqliteJoinType(Parse *pParse, Token + if( pB==0 ){ pB = &dummy; zSp1 = 0; } + if( pC==0 ){ pC = &dummy; zSp2 = 0; } + sqliteSetNString(&pParse->zErrMsg, "unknown or unsupported join type: ", 0, +- pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, 0); ++ pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, (char*)0); + pParse->nErr++; + jointype = JT_INNER; + }else if( jointype & JT_RIGHT ){ +@@ -744,7 +744,7 @@ static void generateColumnNames( + + zTab = pTabList->a[j].zAlias; + if( fullNames || zTab==0 ) zTab = pTab->zName; +- sqliteSetString(&zName, zTab, ".", zCol, 0); ++ sqliteSetString(&zName, zTab, ".", zCol, (char*)0); + sqliteVdbeOp3(v, OP_ColumnName, i, p2, zName, P3_DYNAMIC); + }else{ + sqliteVdbeOp3(v, OP_ColumnName, i, p2, zCol, 0); +@@ -809,19 +809,19 @@ Table *sqliteResultSetOfSelect(Parse *pP + }else if( (p=pEList->a[i].pExpr)->op==TK_DOT + && (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){ + int cnt; +- sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, 0); ++ sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, (char*)0); + for(j=cnt=0; jtoken.z, pR->token.n, zBuf, n,0); ++ sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, zBuf, n, (char*)0); + j = -1; + } + } + }else if( p->span.z && p->span.z[0] ){ +- sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, 0); ++ sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, (char*)0); + }else{ + char zBuf[30]; + sprintf(zBuf, "column%d", i+1); +@@ -879,7 +879,7 @@ static int fillInColumnList(Parse *pPars + char zFakeName[60]; + sprintf(zFakeName, "sqlite_subquery_%p_", + (void*)pTabList->a[i].pSelect); +- sqliteSetString(&pTabList->a[i].zAlias, zFakeName, 0); ++ sqliteSetString(&pTabList->a[i].zAlias, zFakeName, (char*)0); + } + pTabList->a[i].pTab = pTab = + sqliteResultSetOfSelect(pParse, pTabList->a[i].zAlias, +@@ -1003,7 +1003,7 @@ static int fillInColumnList(Parse *pPars + pLeft->token.z = zTabName; + pLeft->token.n = strlen(zTabName); + pLeft->token.dyn = 0; +- sqliteSetString((char**)&pExpr->span.z, zTabName, ".", zName, 0); ++ sqliteSetString((char**)&pExpr->span.z, zTabName, ".", zName, (char*)0); + pExpr->span.n = strlen(pExpr->span.z); + pExpr->span.dyn = 1; + pExpr->token.z = 0; +diff -up sqlite-2.8.17/src/tokenize.c.suse sqlite-2.8.17/src/tokenize.c +--- sqlite-2.8.17/src/tokenize.c.suse 2019-04-10 14:35:30.217290528 -0400 ++++ sqlite-2.8.17/src/tokenize.c 2019-04-10 14:35:41.641034104 -0400 +@@ -434,7 +434,7 @@ int sqliteRunParser(Parse *pParse, const + } + case TK_ILLEGAL: { + sqliteSetNString(pzErrMsg, "unrecognized token: \"", -1, +- pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, 0); ++ pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, (char*)0); + nErr++; + goto abort_parse; + } +diff -up sqlite-2.8.17/src/vdbe.c.suse sqlite-2.8.17/src/vdbe.c +--- sqlite-2.8.17/src/vdbe.c.suse 2019-04-10 14:35:48.752874467 -0400 ++++ sqlite-2.8.17/src/vdbe.c 2019-04-10 14:36:13.433320479 -0400 +@@ -114,7 +114,7 @@ int sqlite_step( + sqlite *db; + int rc; + +- if( p->magic!=VDBE_MAGIC_RUN ){ ++ if( !p || p->magic!=VDBE_MAGIC_RUN ){ + return SQLITE_MISUSE; + } + db = p->db; diff --git a/sqlite-2.8.17-suse-detect-sqlite3.patch b/sqlite-2.8.17-suse-detect-sqlite3.patch new file mode 100644 index 0000000..19dd2a4 --- /dev/null +++ b/sqlite-2.8.17-suse-detect-sqlite3.patch @@ -0,0 +1,43 @@ +diff -up sqlite-2.8.17/src/btree.c.sqlite3 sqlite-2.8.17/src/btree.c +--- sqlite-2.8.17/src/btree.c.sqlite3 2019-04-10 14:39:29.597592819 -0400 ++++ sqlite-2.8.17/src/btree.c 2019-04-10 14:40:51.458892027 -0400 +@@ -112,6 +112,8 @@ typedef struct FreelistInfo FreelistInfo + static const char zMagicHeader[] = + "** This file contains an SQLite 2.1 database **"; + #define MAGIC_SIZE (sizeof(zMagicHeader)) ++static const char zMagicHeader_V3[] = "SQLite format 3"; ++#define MAGIC_SIZE_V3 (sizeof(zMagicHeader_V3)) + + /* + ** This is a magic integer also used to test the integrity of the database +@@ -794,6 +796,8 @@ static int lockBtree(Btree *pBt){ + if( strcmp(pP1->zMagic,zMagicHeader)!=0 || + (pP1->iMagic!=MAGIC && swab32(pP1->iMagic)!=MAGIC) ){ + rc = SQLITE_NOTADB; ++ if( !strcmp(pP1->zMagic,zMagicHeader_V3) ) ++ rc = SQLITE_V3; + goto page1_init_failed; + } + pBt->needSwab = pP1->iMagic!=MAGIC; +diff -up sqlite-2.8.17/src/main.c.sqlite3 sqlite-2.8.17/src/main.c +--- sqlite-2.8.17/src/main.c.sqlite3 2019-04-10 14:41:00.268709401 -0400 ++++ sqlite-2.8.17/src/main.c 2019-04-10 14:41:24.115215151 -0400 +@@ -851,6 +851,7 @@ const char *sqlite_error_string(int rc){ + case SQLITE_FORMAT: z = "auxiliary database format error"; break; + case SQLITE_RANGE: z = "bind index out of range"; break; + case SQLITE_NOTADB: z = "file is encrypted or is not a database";break; ++ case SQLITE_V3: z = "database version mismatch. Try sqlite3";break; + default: z = "unknown error"; break; + } + return z; +diff -up sqlite-2.8.17/src/sqlite.h.in.sqlite3 sqlite-2.8.17/src/sqlite.h.in +--- sqlite-2.8.17/src/sqlite.h.in.sqlite3 2019-04-10 14:41:44.465793362 -0400 ++++ sqlite-2.8.17/src/sqlite.h.in 2019-04-10 14:41:57.761517793 -0400 +@@ -172,6 +172,7 @@ int sqlite_exec( + #define SQLITE_FORMAT 24 /* Auxiliary database format error */ + #define SQLITE_RANGE 25 /* 2nd parameter to sqlite_bind out of range */ + #define SQLITE_NOTADB 26 /* File opened that is not a database file */ ++#define SQLITE_V3 27 /* File opened that is not a database file */ + #define SQLITE_ROW 100 /* sqlite_step() has another row ready */ + #define SQLITE_DONE 101 /* sqlite_step() has finished executing */ + diff --git a/sqlite-2.8.17-tcl.patch b/sqlite-2.8.17-tcl.patch index 72599f5..f4d4545 100644 --- a/sqlite-2.8.17-tcl.patch +++ b/sqlite-2.8.17-tcl.patch @@ -8,7 +8,7 @@ diff -up sqlite-2.8.17/configure.ac.orig sqlite-2.8.17/configure.ac LIBS="" AC_SEARCH_LIBS(Tcl_Init, dnl - tcl8.4 tcl8.3 tcl84 tcl83 tcl,,,$otherlibs) -+ tcl8.5 tcl8.4 tcl8.3 tcl84 tcl83 tcl,,,$otherlibs) ++ tcl8.6 tcl8.5 tcl8.4 tcl8.3 tcl84 tcl83 tcl,,,$otherlibs) fi TARGET_TCL_LIBS="$LIBS $otherlibs" fi diff --git a/sqlite2.spec b/sqlite2.spec index 4b8e2ba..5aca1be 100644 --- a/sqlite2.spec +++ b/sqlite2.spec @@ -3,7 +3,7 @@ Name: sqlite2 Version: 2.8.17 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Embeddable SQL engine in a C library License: Public Domain @@ -19,6 +19,14 @@ Patch7: sqlite-2.8.17-tcl.patch Patch8: sqlite-2.8.17-ppc64.patch Patch9: sqlite-2.8.17-format-security.patch Patch10: sqlite-2.8.17-tcl86.patch +Patch11: sqlite-2.8.17-cleanup-temp-c.patch +Patch12: sqlite-2.8.17-suse-cleanups.patch +Patch13: sqlite-2.8.17-suse-detect-sqlite3.patch +Patch14: sqlite-2.8.17-CVE-2007-1888.patch +Patch15: sqlite-2.8.17-lemon-snprintf.patch +Patch16: sqlite-2.8.17-fix-sort-syntax.patch +Patch17: sqlite-2.8.17-ldflags.patch +Patch18: sqlite-2.8.17-fix-unsigned-FTBFS.patch BuildRequires: gcc-c++ BuildRequires: ncurses-devel, readline-devel, %{_includedir}/tcl.h @@ -73,6 +81,14 @@ find . -type d -name CVS -print0 | xargs -0 rm -r %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 -b .cleanup-tempc +%patch12 -p1 -b .suse +%patch13 -p1 -b .detect-sqlite3 +%patch14 -p1 -b .CVE-2007-1888 +%patch15 -p1 -b .snprintf +%patch16 -p1 -b .fix-sort-syntax +%patch17 -p1 -b .ldflags +%patch18 -p1 -b .unsigned-fix sed -i.rpath 's!__VERSION__!%{version}!g' Makefile.in # Patch additional /usr/lib locations where we don't have $(libdir) # to substitute with. @@ -120,6 +136,10 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/tclsqlite %{tcl_sitearch}/sqlite2/ %changelog +* Wed Apr 10 2019 Tom Callaway - 2.8.17-28 +- bring in all the good fixes from suse and debian + ... including the one that resolves the FTBFS since Fedora 26. yikes. + * Sun Feb 17 2019 Igor Gnatenko - 2.8.17-27 - Rebuild for readline 8.0