/ Check-in [3b461425]
Login

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

Overview
Comment:Fix a NULL pointer dereference following an OOM error in the column name resolver. (CVS 6685)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3b46142532934d17aa136c2e56e58e7828df0f54
User & Date: drh 2009-05-28 14:34:50
Context
2009-05-28
21:04
Remove references to deleted function sqlite3ExprRegister(). Changes to the expr.c source module to promote better testing. (CVS 6686) check-in: 6ae4ad6e user: drh tags: trunk
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
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/resolve.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
69
70
71
72
73
74
75

76
77
78
79
80
81
82
**
*************************************************************************
**
** 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.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
................................................................................
    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 ){







|







 







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
**
*************************************************************************
**
** 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.26 2009/05/28 14:34:50 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
................................................................................
    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);
    if( pDup==0 ) return;
  }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 ){