/ Check-in [4125477e]
Login

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

Overview
Comment:Ensure that comparison operators do not mess up the MEM_Dyn flag on registers when reverting affinity changes. Cherrypick of [02e3c88fbf6a].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.8.6
Files: files | file ages | folders
SHA1: 4125477e63fd3a71dce262e0866d3e39cec765f1
User & Date: dan 2015-05-20 19:44:12
Context
2015-05-20
19:48
Avoid signed integer overflow when converting oversized in-line integer widths and precisions in printf(). Cherrypick of [c494171f77dc], [5ce4e7d7651e], [95625ef3adc3] and [8e4ac2ce2441]. check-in: b330c7ff user: dan tags: branch-3.8.6
19:44
Ensure that comparison operators do not mess up the MEM_Dyn flag on registers when reverting affinity changes. Cherrypick of [02e3c88fbf6a]. check-in: 4125477e user: dan tags: branch-3.8.6
19:34
Fix a problem causing collation sequence names to be dequoted multiple times under some circumstances. Cherrypick of [eddc05e7bb31]. check-in: fc1a4f29 user: dan tags: branch-3.8.6
2015-03-31
11:42
Ensure that comparison operators do not mess up the MEM_Dyn flag on registers when reverting affinity changes. check-in: 02e3c88f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  1982   1982       /* Neither operand is NULL.  Do a comparison. */
  1983   1983       affinity = pOp->p5 & SQLITE_AFF_MASK;
  1984   1984       if( affinity ){
  1985   1985         applyAffinity(pIn1, affinity, encoding);
  1986   1986         applyAffinity(pIn3, affinity, encoding);
  1987   1987         if( db->mallocFailed ) goto no_mem;
  1988   1988       }
         1989  +    flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
         1990  +    flags3 = (pIn3->flags & ~MEM_TypeMask) | (flags3 & MEM_TypeMask);
  1989   1991   
  1990   1992       assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
  1991   1993       ExpandBlob(pIn1);
  1992   1994       ExpandBlob(pIn3);
  1993   1995       res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
  1994   1996     }
  1995   1997     switch( pOp->opcode ){
................................................................................
  2010   2012     }else{
  2011   2013       VdbeBranchTaken(res!=0, (pOp->p5 & SQLITE_NULLEQ)?2:3);
  2012   2014       if( res ){
  2013   2015         pc = pOp->p2-1;
  2014   2016       }
  2015   2017     }
  2016   2018     /* Undo any changes made by applyAffinity() to the input registers. */
         2019  +  assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) );
  2017   2020     pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (flags1&MEM_TypeMask);
         2021  +  assert( (pIn3->flags & MEM_Dyn) == (flags3 & MEM_Dyn) );
  2018   2022     pIn3->flags = (pIn3->flags&~MEM_TypeMask) | (flags3&MEM_TypeMask);
  2019   2023     break;
  2020   2024   }
  2021   2025   
  2022   2026   /* Opcode: Permutation * * * P4 *
  2023   2027   **
  2024   2028   ** Set the permutation used by the OP_Compare operator to be the array

Changes to test/misc1.test.

   616    616     sqlite3_test_control_fault_install fault_callback
   617    617     set fault_callbacks
   618    618   } {0}
   619    619   do_test misc1-19.2 {
   620    620     sqlite3_test_control_fault_install
   621    621     set fault_callbacks
   622    622   } {0}
          623  +
          624  +do_catchsql_test misc1-20.1 {
          625  +  create table t0(o CHar(0)CHECK(0&O>O));
          626  +  insert into t0 select randomblob(0)-trim(0);
          627  +} {1 {CHECK constraint failed: t0}}
          628  +
   623    629   
   624    630   finish_test