SQLite

Check-in [c6e528c1c0]
Login

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

Overview
Comment:Avoid a NULL pointer deref in codeAllEqualityConstraints() following an OOM.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | rowvalue
Files: files | file ages | folders
SHA1: c6e528c1c0f17c69c7745b018afa36694118258f
User & Date: drh 2016-09-06 16:53:53.727
Context
2016-09-06
17:13
Avoid unnecessary memory allocations for aiMap in codeEqualityTerm(). (check-in: 70319c3d76 user: drh tags: rowvalue)
16:53
Avoid a NULL pointer deref in codeAllEqualityConstraints() following an OOM. (check-in: c6e528c1c0 user: drh tags: rowvalue)
16:33
Simplify the fix in commit [7d9bd22c]. (check-in: bd5a342008 user: dan tags: rowvalue)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wherecode.c.
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
    if( (pTerm->eOperator & WO_ISNULL)==0 ){
      if( pTerm->eOperator & WO_IN ){
        if( pTerm->pExpr->flags & EP_xIsSelect ){
          /* No affinity ever needs to be (or should be) applied to a value
          ** from the RHS of an "? IN (SELECT ...)" expression. The 
          ** sqlite3FindInIndex() routine has already ensured that the 
          ** affinity of the comparison has been applied to the value.  */
          zAff[j] = SQLITE_AFF_BLOB;
        }
      }else{
        Expr *pRight = pTerm->pExpr->pRight;
        if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){
          sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);
          VdbeCoverage(v);
        }







|







665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
    if( (pTerm->eOperator & WO_ISNULL)==0 ){
      if( pTerm->eOperator & WO_IN ){
        if( pTerm->pExpr->flags & EP_xIsSelect ){
          /* No affinity ever needs to be (or should be) applied to a value
          ** from the RHS of an "? IN (SELECT ...)" expression. The 
          ** sqlite3FindInIndex() routine has already ensured that the 
          ** affinity of the comparison has been applied to the value.  */
          if( zAff ) zAff[j] = SQLITE_AFF_BLOB;
        }
      }else{
        Expr *pRight = pTerm->pExpr->pRight;
        if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){
          sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);
          VdbeCoverage(v);
        }