SQLite

Check-in [376ecf0d87]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 376ecf0d87e4a2329f5861401f83ed9ceb35d528
User & Date: drh 2009-05-28 12:49:53.000
Context
2009-05-28
14:34
Fix a NULL pointer dereference following an OOM error in the column name resolver. (CVS 6685) (check-in: 3b46142532 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: 376ecf0d87 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: 5904af6e6d user: danielk1977 tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/resolve.c.
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24







-
+







**
*************************************************************************
**
** This file contains routines used for walking the parser tree and
** resolve all identifiers by associating them with a particular
** table and column.
**
** $Id: resolve.c,v 1.24 2009/05/28 01:00:55 drh Exp $
** $Id: resolve.c,v 1.25 2009/05/28 12:49:53 drh Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
#include <string.h>

/*
** Turn the pExpr expression into an alias for the iCol-th column of the
67
68
69
70
71
72
73


74
75
76
77
78
79
80
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82







+
+







    pDup = sqlite3ExprDup(db, pOrig, 0);
    pDup = sqlite3PExpr(pParse, TK_AS, pDup, 0, 0);
    if( pDup==0 ) return;
    if( pEList->a[iCol].iAlias==0 ){
      pEList->a[iCol].iAlias = (u16)(++pParse->nAlias);
    }
    pDup->iTable = pEList->a[iCol].iAlias;
  }else if( ExprHasProperty(pOrig, EP_IntValue) || pOrig->u.zToken==0 ){
    pDup = sqlite3ExprDup(db, pOrig, 0);
  }else{
    char *zToken = pOrig->u.zToken;
    pOrig->u.zToken = 0;
    pDup = sqlite3ExprDup(db, pOrig, 0);
    pOrig->u.zToken = zToken;
    if( pDup==0 ) return;
    if( zToken ){