1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Fix an out-of-memory NULL pointer defer in the code generator. Ticket #2843. (CVS 4630)

FossilOrigin-Name: b821b6ed176b4259e1d4b56c8eb548933b6f530a
This commit is contained in:
drh
2007-12-14 15:12:21 +00:00
parent 85b623f2f9
commit 49df6b749c
5 changed files with 28 additions and 13 deletions

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.319 2007/12/13 21:54:11 drh Exp $
** $Id: expr.c,v 1.320 2007/12/14 15:12:21 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -2322,13 +2322,15 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
*/
void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr){
Vdbe *v = pParse->pVdbe;
VdbeOp *pOp;
int iMem;
int addr1, addr2;
if( v==0 ) return;
addr1 = sqlite3VdbeCurrentAddr(v);
sqlite3ExprCode(pParse, pExpr);
addr2 = sqlite3VdbeCurrentAddr(v);
if( addr2>addr1+1 || sqlite3VdbeGetOp(v, addr1)->opcode==OP_Function ){
if( addr2>addr1+1
|| ((pOp = sqlite3VdbeGetOp(v, addr1))!=0 && pOp->opcode==OP_Function) ){
iMem = pExpr->iTable = pParse->nMem++;
sqlite3VdbeAddOp(v, OP_MemStore, iMem, 0);
pExpr->op = TK_REGISTER;