SQLite

Check-in [0e021887]
Login

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

Overview
Comment:Fix a possible ASAN violation inside of debug-only code following an OOM.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | early-winfunc-rewrite-dev
Files: files | file ages | folders
SHA3-256: 0e021887a1307fa3905581175776c56660dd9f545483715831bfaeb243f7bdc6
User & Date: drh 2020-06-06 19:54:01
Context
2020-06-07
00:43
Extra steps to ensure that queries that involve both window functions and aggregate functions are processed correctly by sqlite3WindowRewrite(). Fix for ticket [e5504e987e419fb0]. (check-in: a6c2147c user: drh tags: early-winfunc-rewrite-dev)
2020-06-06
20:48
Merge multiple changes from trunk to address concerns with window-function parse-tree rewriting. (check-in: 05418b2a user: drh tags: branch-3.32-early-winfunc-rewrite)
19:54
Fix a possible ASAN violation inside of debug-only code following an OOM. (check-in: 0e021887 user: drh tags: early-winfunc-rewrite-dev)
19:35
When determining if the subquery inserted by the window-function rewriter is an aggregate query, aggregate functions that are in parameters to another window function do not count. Fix for ticket [1f6f353b684fc708] (check-in: 8583c348 user: drh tags: early-winfunc-rewrite-dev)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/select.c.

6795
6796
6797
6798
6799
6800
6801

6802
6803
6804
6805

6806
6807
6808
6809
6810
6811
6812
  /* Control jumps to here if an error is encountered above, or upon
  ** successful coding of the SELECT.
  */
select_end:
  sqlite3ExprListDelete(db, pMinMaxOrderBy);
  sqlite3DbFree(db, sAggInfo.aCol);
#ifdef SQLITE_DEBUG

  for(i=0; i<sAggInfo.nFunc; i++){
    assert( sAggInfo.aFunc[i].pExpr!=0 );
    assert( sAggInfo.aFunc[i].pExpr->pAggInfo==&sAggInfo );
    sAggInfo.aFunc[i].pExpr->pAggInfo = 0;

  }
  sAggInfo.iAggMagic = 0;
#endif
  sqlite3DbFree(db, sAggInfo.aFunc);
#if SELECTTRACE_ENABLED
  SELECTTRACE(0x1,pParse,p,("end processing\n"));
  if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){







>
|
|
|
|
>







6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
  /* Control jumps to here if an error is encountered above, or upon
  ** successful coding of the SELECT.
  */
select_end:
  sqlite3ExprListDelete(db, pMinMaxOrderBy);
  sqlite3DbFree(db, sAggInfo.aCol);
#ifdef SQLITE_DEBUG
  if( db->mallocFailed==0 ){
    for(i=0; i<sAggInfo.nFunc; i++){
      assert( sAggInfo.aFunc[i].pExpr!=0 );
      assert( sAggInfo.aFunc[i].pExpr->pAggInfo==&sAggInfo );
      sAggInfo.aFunc[i].pExpr->pAggInfo = 0;
    }
  }
  sAggInfo.iAggMagic = 0;
#endif
  sqlite3DbFree(db, sAggInfo.aFunc);
#if SELECTTRACE_ENABLED
  SELECTTRACE(0x1,pParse,p,("end processing\n"));
  if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){