From a6c1a71cde082e09750465d5675699062922e387 Mon Sep 17 00:00:00 2001
From: dan <dan@noemail.net>
Date: Fri, 27 Dec 2019 20:54:42 +0000
Subject: [PATCH] Fix CVE-2019-20218
 Do not attempt to unwind the WITH stack in the Parse object
 following an error. This fixes a separate case to [de6e6d68].

FossilOrigin-Name: d29edef93451cc67a5d69c1cce1b1832d9ca8fff1f600afdd51338b74d077b92

Change by Weifeng <suweifeng1@huawei.com>:
    Fit for version 3.24.0
---
 src/select.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/select.c b/src/select.c
index f78c8a5..3bb98ad 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4717,7 +4717,7 @@ static int selectExpander(Walker *pWalker, Select *p){
 
   /* Process NATURAL keywords, and ON and USING clauses of joins.
   */
-  if( db->mallocFailed || sqliteProcessJoin(pParse, p) ){
+  if( pParse->nErr || db->mallocFailed || sqliteProcessJoin(pParse, p) ){
     return WRC_Abort;
   }
 
-- 
2.19.1


