/ Check-in [bd5a3420]
Login

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

Overview
Comment:Simplify the fix in commit [7d9bd22c].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rowvalue
Files: files | file ages | folders
SHA1: bd5a342008575bf66f63881a0bebf43741f2a67b
User & Date: dan 2016-09-06 16:33:24
Context
2016-09-06
16:53
Avoid a NULL pointer deref in codeAllEqualityConstraints() following an OOM. check-in: c6e528c1 user: drh tags: rowvalue
16:33
Simplify the fix in commit [7d9bd22c]. check-in: bd5a3420 user: dan tags: rowvalue
15:25
Fix the header comment on codeEqualityTerm(). check-in: b7e710e4 user: drh tags: rowvalue
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

659
660
661
662
663
664
665
666
667
668

669
670


671
672
673
674
675
676
677
678
679
680
681
682
683
684

685
686
687
688
689
690
691
      }else{
        sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j);
      }
    }
    testcase( pTerm->eOperator & WO_ISNULL );
    testcase( pTerm->eOperator & WO_IN );
    if( (pTerm->eOperator & WO_ISNULL)==0 ){
      Expr *pRight = 0;
      if( pTerm->eOperator & WO_IN ){
        if( pTerm->pExpr->flags & EP_xIsSelect ){

          int iField = pTerm->iField ? pTerm->iField-1 : 0;
          pRight = pTerm->pExpr->x.pSelect->pEList->a[iField].pExpr;


        }
      }else{
        pRight = pTerm->pExpr->pRight;
        if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){
          sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);
          VdbeCoverage(v);
        }
      }
      if( pRight && zAff ){
        if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){
          zAff[j] = SQLITE_AFF_BLOB;
        }
        if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){
          zAff[j] = SQLITE_AFF_BLOB;

        }
      }
    }
  }
  *pzAff = zAff;
  return regBase;
}







<


>
|
|
>
>


|




<
|
|
|
|
|
|
>







659
660
661
662
663
664
665

666
667
668
669
670
671
672
673
674
675
676
677
678
679

680
681
682
683
684
685
686
687
688
689
690
691
692
693
      }else{
        sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j);
      }
    }
    testcase( pTerm->eOperator & WO_ISNULL );
    testcase( pTerm->eOperator & WO_IN );
    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);
        }

        if( zAff ){
          if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){
            zAff[j] = SQLITE_AFF_BLOB;
          }
          if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){
            zAff[j] = SQLITE_AFF_BLOB;
          }
        }
      }
    }
  }
  *pzAff = zAff;
  return regBase;
}