Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a reference to freed memory that can occur following an OOM error in where.c. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
929b6047391411c6f539e47afe6b63d1 |
User & Date: | drh 2009-11-16 22:54:51.000 |
Context
2009-11-16
| ||
23:36 | Make sure the output of sqlite3OsFullPathname is initialized even if the fails due to I/O or OOM errors. (check-in: e4943adb83 user: drh tags: trunk) | |
22:54 | Fix a reference to freed memory that can occur following an OOM error in where.c. (check-in: 929b604739 user: drh tags: trunk) | |
21:28 | Back out part of the change in [23ea2b700fd6d28d] since TH3 reveals some problems in OOM situations. (check-in: 15d215d62d user: drh tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
2590 2591 2592 2593 2594 2595 2596 | } } /* ** Code an OP_Affinity opcode to apply the column affinity string zAff ** to the n registers starting at base. ** | | < < | | 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 | } } /* ** Code an OP_Affinity opcode to apply the column affinity string zAff ** to the n registers starting at base. ** ** This routine assumes that zAff is dynamic and makes its own copy. */ static void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){ Vdbe *v = pParse->pVdbe; assert( v!=0 ); sqlite3VdbeAddOp2(v, OP_Affinity, base, n); sqlite3VdbeChangeP4(v, -1, zAff, 0); sqlite3ExprCacheAffinityChange(pParse, base, n); } /* ** Generate code for a single equality term of the WHERE clause. An equality ** term can be either X=expr or X IN (...). pTerm is the term to be |
︙ | ︙ | |||
3126 3127 3128 3129 3130 3131 3132 | */ nConstraint = nEq; if( pRangeEnd ){ Expr *pRight = pRangeEnd->pExpr->pRight; sqlite3ExprCacheRemove(pParse, regBase+nEq); sqlite3ExprCode(pParse, pRight, regBase+nEq); sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); | < > | 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 | */ nConstraint = nEq; if( pRangeEnd ){ Expr *pRight = pRangeEnd->pExpr->pRight; sqlite3ExprCacheRemove(pParse, regBase+nEq); sqlite3ExprCode(pParse, pRight, regBase+nEq); sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); if( zAff && sqlite3CompareAffinity(pRight, zAff[nConstraint])==SQLITE_AFF_NONE ){ /* Since the comparison is to be performed with no conversions applied ** to the operands, set the affinity to apply to pRight to ** SQLITE_AFF_NONE. */ zAff[nConstraint] = SQLITE_AFF_NONE; } codeApplyAffinity(pParse, regBase, nEq+1, zAff); nConstraint++; } sqlite3DbFree(pParse->db, zAff); /* Top of the loop body */ pLevel->p2 = sqlite3VdbeCurrentAddr(v); /* Check if the index cursor is past the end of the range. */ op = aEndOp[(pRangeEnd || nEq) * (1 + bRev)]; testcase( op==OP_Noop ); |
︙ | ︙ |