diff options
| author | Changqing Li <changqing.li@windriver.com> | 2021-09-14 12:35:50 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-17 21:31:37 +0100 |
| commit | a5e9dd4bc60fe7faf9909927b2cc2b572667dc13 (patch) | |
| tree | b823d4107c7f140dea621bf50e696f1a7060e1d7 | |
| parent | 7de4e6b5826f804882b58fd845e74e0003281cef (diff) | |
| download | poky-a5e9dd4bc60fe7faf9909927b2cc2b572667dc13.tar.gz | |
sqlite3: fix CVE-2021-36690
refer:
https://nvd.nist.gov/vuln/detail/CVE-2021-36690
https://www.sqlite.org/forum/forumpost/718c0a8d17
https://sqlite.org/src/info/b1e0c22ec981cf5f
(From OE-Core rev: b0c311d784e939342c4bfa771790a0113fc7a704)
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-support/sqlite/sqlite3/CVE-2021-36690.patch | 62 | ||||
| -rw-r--r-- | meta/recipes-support/sqlite/sqlite3_3.35.0.bb | 4 |
2 files changed, 65 insertions, 1 deletions
diff --git a/meta/recipes-support/sqlite/sqlite3/CVE-2021-36690.patch b/meta/recipes-support/sqlite/sqlite3/CVE-2021-36690.patch new file mode 100644 index 0000000000..d383696e42 --- /dev/null +++ b/meta/recipes-support/sqlite/sqlite3/CVE-2021-36690.patch | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | From c286324a7ff1e98355b638fb821614a65ee03c0c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Changqing Li <changqing.li@windriver.com> | ||
| 3 | Date: Tue, 14 Sep 2021 11:28:54 +0800 | ||
| 4 | Subject: [PATCH] Fix an issue with the SQLite Expert extension when a column | ||
| 5 | has no collating sequence. Forum post 78165fa250. | ||
| 6 | |||
| 7 | Upstream-Status: Backport [https://sqlite.org/src/info/b1e0c22ec981cf5f] | ||
| 8 | CVE: CVE-2021-36690 | ||
| 9 | |||
| 10 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
| 11 | --- | ||
| 12 | shell.c | 14 +++++++++----- | ||
| 13 | 1 file changed, 9 insertions(+), 5 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/shell.c b/shell.c | ||
| 16 | index de8a665..69a5c05 100644 | ||
| 17 | --- a/shell.c | ||
| 18 | +++ b/shell.c | ||
| 19 | @@ -9054,11 +9054,13 @@ static int idxGetTableInfo( | ||
| 20 | rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab); | ||
| 21 | while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ | ||
| 22 | const char *zCol = (const char*)sqlite3_column_text(p1, 1); | ||
| 23 | + const char *zColSeq = 0; | ||
| 24 | nByte += 1 + STRLEN(zCol); | ||
| 25 | rc = sqlite3_table_column_metadata( | ||
| 26 | - db, "main", zTab, zCol, 0, &zCol, 0, 0, 0 | ||
| 27 | + db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 | ||
| 28 | ); | ||
| 29 | - nByte += 1 + STRLEN(zCol); | ||
| 30 | + if( zColSeq==0 ) zColSeq = "binary"; | ||
| 31 | + nByte += 1 + STRLEN(zColSeq); | ||
| 32 | nCol++; | ||
| 33 | nPk += (sqlite3_column_int(p1, 5)>0); | ||
| 34 | } | ||
| 35 | @@ -9078,6 +9080,7 @@ static int idxGetTableInfo( | ||
| 36 | nCol = 0; | ||
| 37 | while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ | ||
| 38 | const char *zCol = (const char*)sqlite3_column_text(p1, 1); | ||
| 39 | + const char *zColSeq = 0; | ||
| 40 | int nCopy = STRLEN(zCol) + 1; | ||
| 41 | pNew->aCol[nCol].zName = pCsr; | ||
| 42 | pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1); | ||
| 43 | @@ -9085,12 +9088,13 @@ static int idxGetTableInfo( | ||
| 44 | pCsr += nCopy; | ||
| 45 | |||
| 46 | rc = sqlite3_table_column_metadata( | ||
| 47 | - db, "main", zTab, zCol, 0, &zCol, 0, 0, 0 | ||
| 48 | + db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 | ||
| 49 | ); | ||
| 50 | if( rc==SQLITE_OK ){ | ||
| 51 | - nCopy = STRLEN(zCol) + 1; | ||
| 52 | + if( zColSeq==0 ) zColSeq = "binary"; | ||
| 53 | + nCopy = STRLEN(zColSeq) + 1; | ||
| 54 | pNew->aCol[nCol].zColl = pCsr; | ||
| 55 | - memcpy(pCsr, zCol, nCopy); | ||
| 56 | + memcpy(pCsr, zColSeq, nCopy); | ||
| 57 | pCsr += nCopy; | ||
| 58 | } | ||
| 59 | |||
| 60 | -- | ||
| 61 | 2.17.1 | ||
| 62 | |||
diff --git a/meta/recipes-support/sqlite/sqlite3_3.35.0.bb b/meta/recipes-support/sqlite/sqlite3_3.35.0.bb index 127065bbc1..8b2732640f 100644 --- a/meta/recipes-support/sqlite/sqlite3_3.35.0.bb +++ b/meta/recipes-support/sqlite/sqlite3_3.35.0.bb | |||
| @@ -3,7 +3,9 @@ require sqlite3.inc | |||
| 3 | LICENSE = "PD" | 3 | LICENSE = "PD" |
| 4 | LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed00c66" | 4 | LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed00c66" |
| 5 | 5 | ||
| 6 | SRC_URI = "http://www.sqlite.org/2021/sqlite-autoconf-${SQLITE_PV}.tar.gz" | 6 | SRC_URI = "http://www.sqlite.org/2021/sqlite-autoconf-${SQLITE_PV}.tar.gz \ |
| 7 | file://CVE-2021-36690.patch \ | ||
| 8 | " | ||
| 7 | SRC_URI[sha256sum] = "3dfb3f143c83695a555c7dd9e06ed924f9d273c287989874e102656724baf2d0" | 9 | SRC_URI[sha256sum] = "3dfb3f143c83695a555c7dd9e06ed924f9d273c287989874e102656724baf2d0" |
| 8 | 10 | ||
| 9 | # -19242 is only an issue in specific development branch commits | 11 | # -19242 is only an issue in specific development branch commits |
