summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/sqlite/patches/0009-Make-sure-WITH-stack-is-disabled-after-error.patch
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/sqlite/patches/0009-Make-sure-WITH-stack-is-disabled-after-error.patch')
-rw-r--r--chromium/third_party/sqlite/patches/0009-Make-sure-WITH-stack-is-disabled-after-error.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/chromium/third_party/sqlite/patches/0009-Make-sure-WITH-stack-is-disabled-after-error.patch b/chromium/third_party/sqlite/patches/0009-Make-sure-WITH-stack-is-disabled-after-error.patch
new file mode 100644
index 00000000000..8c9fb2ba5c2
--- /dev/null
+++ b/chromium/third_party/sqlite/patches/0009-Make-sure-WITH-stack-is-disabled-after-error.patch
@@ -0,0 +1,64 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Darwin Huang <huangdarwin@chromium.org>
+Date: Tue, 3 Dec 2019 13:56:38 -0800
+Subject: [PATCH 09/25] Make sure WITH stack is disabled after error
+
+Backports https://sqlite.org/src/info/de6e6d6846d6a41c
+
+Bug: 1021016
+---
+ third_party/sqlite/patched/src/select.c | 3 +++
+ third_party/sqlite/patched/src/util.c | 1 +
+ third_party/sqlite/patched/test/with3.test | 10 +++++++++-
+ 3 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/third_party/sqlite/patched/src/select.c b/third_party/sqlite/patched/src/select.c
+index 429d3dc817aa..ba70a2bdec78 100644
+--- a/third_party/sqlite/patched/src/select.c
++++ b/third_party/sqlite/patched/src/select.c
+@@ -4666,6 +4666,9 @@ static int withExpand(
+ With *pWith; /* WITH clause that pCte belongs to */
+
+ assert( pFrom->pTab==0 );
++ if( pParse->nErr ){
++ return SQLITE_ERROR;
++ }
+
+ pCte = searchWith(pParse->pWith, pFrom, &pWith);
+ if( pCte ){
+diff --git a/third_party/sqlite/patched/src/util.c b/third_party/sqlite/patched/src/util.c
+index d70b93bb79b7..430cdb64742f 100644
+--- a/third_party/sqlite/patched/src/util.c
++++ b/third_party/sqlite/patched/src/util.c
+@@ -192,6 +192,7 @@ void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
+ sqlite3DbFree(db, pParse->zErrMsg);
+ pParse->zErrMsg = zMsg;
+ pParse->rc = SQLITE_ERROR;
++ pParse->pWith = 0;
+ }
+ }
+
+diff --git a/third_party/sqlite/patched/test/with3.test b/third_party/sqlite/patched/test/with3.test
+index f651207d2901..99b64e957ffa 100644
+--- a/third_party/sqlite/patched/test/with3.test
++++ b/third_party/sqlite/patched/test/with3.test
+@@ -30,7 +30,15 @@ do_catchsql_test 1.0 {
+ SELECT 5 FROM t0 UNION SELECT 8 FROM m
+ )
+ SELECT * FROM i;
+-} {1 {no such table: m}}
++} {1 {no such table: t0}}
++
++# 2019-11-09 dbfuzzcheck find
++do_catchsql_test 1.1 {
++ CREATE VIEW v1(x,y) AS
++ WITH t1(a,b) AS (VALUES(1,2))
++ SELECT * FROM nosuchtable JOIN t1;
++ SELECT * FROM v1;
++} {1 {no such table: main.nosuchtable}}
+
+ # Additional test cases that came out of the work to
+ # fix for Kostya's problem.
+--
+2.25.0.rc1.283.g88dfdc4193-goog
+