diff options
author | Sinan Kaya <okaya@kernel.org> | 2018-09-22 02:16:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-09-27 12:17:46 +0100 |
commit | a36165011e5bbdef3a4e81ef33eeb57794678ebb (patch) | |
tree | f89876f7da00ed630374d6f702727a298671f550 /meta/recipes-support/sqlite/files | |
parent | b77082e38f8d6b94001df83d66fbfef0dad970cd (diff) | |
download | poky-a36165011e5bbdef3a4e81ef33eeb57794678ebb.tar.gz |
sqlite3: CVE-2018-8740
* CVE-2018-8740
In SQLite through 3.22.0, databases whose schema is corrupted
using a CREATE TABLE AS statement could cause a NULL pointer dereference,
related to build.c and prepare.c.
Affects sqlite3 <= 3.22.0
CVE: CVE-2018-8740
Ref: https://access.redhat.com/security/cve/cve-2018-8740
(From OE-Core rev: 0469c075d904026ec37214fb39397bb1cb07ab43)
Signed-off-by: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/sqlite/files')
-rw-r--r-- | meta/recipes-support/sqlite/files/CVE-2018-8740.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/meta/recipes-support/sqlite/files/CVE-2018-8740.patch b/meta/recipes-support/sqlite/files/CVE-2018-8740.patch new file mode 100644 index 0000000000..5d95e37afe --- /dev/null +++ b/meta/recipes-support/sqlite/files/CVE-2018-8740.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 19aed4d2be46c4516caf2bee31f79044bbd1d57d Mon Sep 17 00:00:00 2001 | ||
2 | From: Sinan Kaya <okaya@kernel.org> | ||
3 | Date: Fri, 21 Sep 2018 16:22:01 +0000 | ||
4 | Subject: [PATCH] Detect databases whose schema is corrupted using a CREATE TABLE AS statement and issue an appropriate error message | ||
5 | |||
6 | Upstream-Status: Backport [ https://www.sqlite.org/cgi/src/vdiff?from=1774f1c3baf0bc3d&to=d75e67654aa9620b&diff=1&w] | ||
7 | Signed-off-by: Sinan Kaya <okaya@kernel.org> | ||
8 | --- | ||
9 | sqlite3.c | 8 +++++--- | ||
10 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
11 | |||
12 | diff --git a/sqlite3.c b/sqlite3.c | ||
13 | index 73c69ef..6863bc6 100644 | ||
14 | --- a/sqlite3.c | ||
15 | +++ b/sqlite3.c | ||
16 | @@ -103474,8 +103474,6 @@ SQLITE_PRIVATE void sqlite3EndTable( | ||
17 | p = pParse->pNewTable; | ||
18 | if( p==0 ) return; | ||
19 | |||
20 | - assert( !db->init.busy || !pSelect ); | ||
21 | - | ||
22 | /* If the db->init.busy is 1 it means we are reading the SQL off the | ||
23 | ** "sqlite_master" or "sqlite_temp_master" table on the disk. | ||
24 | ** So do not write to the disk again. Extract the root page number | ||
25 | @@ -103486,6 +103484,10 @@ SQLITE_PRIVATE void sqlite3EndTable( | ||
26 | ** table itself. So mark it read-only. | ||
27 | */ | ||
28 | if( db->init.busy ){ | ||
29 | + if( pSelect ){ | ||
30 | + sqlite3ErrorMsg(pParse, ""); | ||
31 | + return; | ||
32 | + } | ||
33 | p->tnum = db->init.newTnum; | ||
34 | if( p->tnum==1 ) p->tabFlags |= TF_Readonly; | ||
35 | } | ||
36 | @@ -117813,7 +117815,7 @@ static void corruptSchema( | ||
37 | char *z; | ||
38 | if( zObj==0 ) zObj = "?"; | ||
39 | z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj); | ||
40 | - if( zExtra ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra); | ||
41 | + if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra); | ||
42 | sqlite3DbFree(db, *pData->pzErrMsg); | ||
43 | *pData->pzErrMsg = z; | ||
44 | } | ||
45 | -- | ||
46 | 2.19.0 | ||
47 | |||