View | Details | Raw Unified | Return to bug 226840
Collapse All | Expand All

(-)databases/sqlite3/files/patch-sqlite3.c (+36 lines)
Line 0 Link Here
1
Detect databases whose schema is corrupted using a CREATE TABLE AS statement and issue an appropriate error message.
2
Check-in [d75e6765], https://www.sqlite.org/src/info/d75e67654aa9620b
3
https://bugs.launchpad.net/ubuntu/+source/sqlite3/+bug/1756349
4
https://nvd.nist.gov/vuln/detail/CVE-2018-8740
5
6
--- sqlite3.c.orig	2018-03-22 07:08:21 UTC
7
+++ sqlite3.c
8
@@ -103474,8 +103474,6 @@ SQLITE_PRIVATE void sqlite3EndTable(
9
   p = pParse->pNewTable;
10
   if( p==0 ) return;
11
 
12
-  assert( !db->init.busy || !pSelect );
13
-
14
   /* If the db->init.busy is 1 it means we are reading the SQL off the
15
   ** "sqlite_master" or "sqlite_temp_master" table on the disk.
16
   ** So do not write to the disk again.  Extract the root page number
17
@@ -103486,6 +103484,10 @@ SQLITE_PRIVATE void sqlite3EndTable(
18
   ** table itself.  So mark it read-only.
19
   */
20
   if( db->init.busy ){
21
+    if( pSelect ){
22
+      sqlite3ErrorMsg(pParse, "");
23
+      return;
24
+    }
25
     p->tnum = db->init.newTnum;
26
     if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
27
   }
28
@@ -117813,7 +117815,7 @@ static void corruptSchema(
29
     char *z;
30
     if( zObj==0 ) zObj = "?";
31
     z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
32
-    if( zExtra ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
33
+    if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
34
     sqlite3DbFree(db, *pData->pzErrMsg);
35
     *pData->pzErrMsg = z;
36
   }
(-)databases/sqlite3/Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	sqlite3
4
PORTNAME=	sqlite3
5
DISTVERSION=	3.22.0
5
DISTVERSION=	3.22.0
6
PORTREVISION=	1
6
CATEGORIES=	databases
7
CATEGORIES=	databases
7
MASTER_SITES=	https://www.sqlite.org/2018/ http://www2.sqlite.org/2018/ http://www3.sqlite.org/2018/
8
MASTER_SITES=	https://www.sqlite.org/2018/ http://www2.sqlite.org/2018/ http://www3.sqlite.org/2018/
8
DISTNAME=	sqlite-autoconf-${PORTVERSION:C/\.([[:digit:]])[[:>:]]/0\1/g:S/.//g}00
9
DISTNAME=	sqlite-autoconf-${PORTVERSION:C/\.([[:digit:]])[[:>:]]/0\1/g:S/.//g}00

Return to bug 226840