/ Check-in [9e6eae66]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure errors in the FROM clause of a SELECT cause analysis to abort and unwind the stack before those errors have a chance to mischief in the "*" column-name wildcard expander. Fix for ticket [32b63d542433ca67].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9e6eae660a02303fd140dac5fbff82364f4120cd
User & Date: drh 2015-01-22 12:00:17
Context
2015-01-24
12:12
In the command-line shell, make sure stderr is unbuffered so that it automatically flushes. This has always been the case already for unix and on Windows when the output is a console, but apparently was not the case on Windows when the output was a pipe. check-in: 2a9ea9b4 user: drh tags: trunk
2015-01-22
12:00
Make sure errors in the FROM clause of a SELECT cause analysis to abort and unwind the stack before those errors have a chance to mischief in the "*" column-name wildcard expander. Fix for ticket [32b63d542433ca67]. check-in: 9e6eae66 user: drh tags: trunk
11:29
Change the undocumented ".selecttrace" command in the shell to accept an integer bitmask rather than a boolean. check-in: bd63bf88 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

  4149   4149   #endif
  4150   4150       if( pFrom->zName==0 ){
  4151   4151   #ifndef SQLITE_OMIT_SUBQUERY
  4152   4152         Select *pSel = pFrom->pSelect;
  4153   4153         /* A sub-query in the FROM clause of a SELECT */
  4154   4154         assert( pSel!=0 );
  4155   4155         assert( pFrom->pTab==0 );
  4156         -      sqlite3WalkSelect(pWalker, pSel);
         4156  +      if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort;
  4157   4157         pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
  4158   4158         if( pTab==0 ) return WRC_Abort;
  4159   4159         pTab->nRef = 1;
  4160   4160         pTab->zName = sqlite3MPrintf(db, "sqlite_sq_%p", (void*)pTab);
  4161   4161         while( pSel->pPrior ){ pSel = pSel->pPrior; }
  4162   4162         selectColumnsFromExprList(pParse, pSel->pEList, &pTab->nCol, &pTab->aCol);
  4163   4163         pTab->iPKey = -1;

Changes to test/fuzz2.test.

   120    120   do_test fuzz2-6.4a {
   121    121     db eval {DROP TABLE IF EXISTS t0; CREATE TABLE t0(t);}
   122    122     catchsql {INSERT INTO t0 SELECT strftime();}
   123    123   } {0 {}}
   124    124   do_test fuzz2-6.4b {
   125    125     db eval {SELECT quote(t) FROM t0} 
   126    126   } {NULL}
          127  +
          128  +# Another test case discovered by Michal Zalewski, this on on 2015-01-22.
          129  +# Ticket 32b63d542433ca6757cd695aca42addf8ed67aa6
          130  +#
          131  +do_test fuzz2-7.1 {
          132  +  catchsql {select e.*,0 from(s,(L))e;}
          133  +} {1 {no such table: s}}
          134  +do_test fuzz2-7.2 {
          135  +  catchsql {SELECT c.* FROM (a,b) AS c}
          136  +} {1 {no such table: a}}
   127    137   
   128    138   
   129    139   finish_test