/ Check-in [376ecf0d]
Login

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

Overview
Comment:Make sure the column name resolver does not try to duplicate Expr.u.zToken when the Expr.u.iValue union member is the element being used. (CVS 6684)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 376ecf0d87e4a2329f5861401f83ed9ceb35d528
User & Date: drh 2009-05-28 12:49:53
Context
2009-05-28
14:34
Fix a NULL pointer dereference following an OOM error in the column name resolver. (CVS 6685) check-in: 3b461425 user: drh tags: trunk
12:49
Make sure the column name resolver does not try to duplicate Expr.u.zToken when the Expr.u.iValue union member is the element being used. (CVS 6684) check-in: 376ecf0d user: drh tags: trunk
11:05
Workaround the need for internal API sqlite3BtreeCursorDb(). It was only being used for an assert() statement, which can be done differently. (CVS 6683) check-in: 5904af6e user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/resolve.c.

    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains routines used for walking the parser tree and
    14     14   ** resolve all identifiers by associating them with a particular
    15     15   ** table and column.
    16     16   **
    17         -** $Id: resolve.c,v 1.24 2009/05/28 01:00:55 drh Exp $
           17  +** $Id: resolve.c,v 1.25 2009/05/28 12:49:53 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdlib.h>
    21     21   #include <string.h>
    22     22   
    23     23   /*
    24     24   ** Turn the pExpr expression into an alias for the iCol-th column of the
................................................................................
    67     67       pDup = sqlite3ExprDup(db, pOrig, 0);
    68     68       pDup = sqlite3PExpr(pParse, TK_AS, pDup, 0, 0);
    69     69       if( pDup==0 ) return;
    70     70       if( pEList->a[iCol].iAlias==0 ){
    71     71         pEList->a[iCol].iAlias = (u16)(++pParse->nAlias);
    72     72       }
    73     73       pDup->iTable = pEList->a[iCol].iAlias;
           74  +  }else if( ExprHasProperty(pOrig, EP_IntValue) || pOrig->u.zToken==0 ){
           75  +    pDup = sqlite3ExprDup(db, pOrig, 0);
    74     76     }else{
    75     77       char *zToken = pOrig->u.zToken;
    76     78       pOrig->u.zToken = 0;
    77     79       pDup = sqlite3ExprDup(db, pOrig, 0);
    78     80       pOrig->u.zToken = zToken;
    79     81       if( pDup==0 ) return;
    80     82       if( zToken ){