/ Check-in [413015c0]
Login

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

Overview
Comment:Avoid a NULL-pointer deref following OOM.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sorter-reference
Files: files | file ages | folders
SHA3-256:413015c029d850d4ce7e66be1f59b57f291254240a958856378a62f5ac4a5092
User & Date: drh 2018-04-18 19:08:44
Context
2018-04-18
19:56
Add the "sorter-reference" optimization, allowing SQLite to be configured so that some required values may be loaded from the database after external sorting occurs for SELECT statements with ORDER BY clauses that are not satisfied by database indexes. check-in: ef74090a user: dan tags: trunk
19:08
Avoid a NULL-pointer deref following OOM. Closed-Leaf check-in: 413015c0 user: drh tags: sorter-reference
15:21
Add the --sorterref N option to the CLI. check-in: 902a4089 user: drh tags: sorter-reference
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

   880    880           int j;
   881    881           if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){
   882    882             p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
   883    883           }
   884    884         }
   885    885   #ifdef SQLITE_ENABLE_SORTER_REFERENCES
   886    886         selectExprDefer(pParse, pSort, p->pEList, &pExtra);
   887         -      if( pExtra ){
          887  +      if( pExtra && pParse->db->mallocFailed==0 ){
   888    888           /* If there are any extra PK columns to add to the sorter records,
   889    889           ** allocate extra memory cells and adjust the OpenEphemeral 
   890    890           ** instruction to account for the larger records. This is only
   891    891           ** required if there are one or more WITHOUT ROWID tables with
   892    892           ** composite primary keys in the SortCtx.aDefer[] array.  */
   893    893           VdbeOp *pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);
   894    894           pOp->p2 += (pExtra->nExpr - pSort->nDefer);