/ Check-in [304ea6ba]
Login

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

Overview
Comment:In the OP_Column opcode, when extracting a field that is past the end of a short record (because the row was originally inserted prior to ALTER TABLE ADD COLUMN) then make sure the output register is fully NULL and does not contain leftover flags (such as MEM_Ephem) from its previous use. Fix for ticket [43107840f1c02]. This is a cherrypick of check-in [24780f8ddc1683fc].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.8.7
Files: files | file ages | folders
SHA1: 304ea6ba6f4cf40a76d32d37af73a253f493ba47
User & Date: drh 2014-10-29 01:13:58
Context
2014-10-29
01:18
Disable the use of strchrnul() unless specifically enabled by compile-time options. Cherrypick of check-in [e580470db77d6da9] check-in: 837368ad user: drh tags: branch-3.8.7
01:13
In the OP_Column opcode, when extracting a field that is past the end of a short record (because the row was originally inserted prior to ALTER TABLE ADD COLUMN) then make sure the output register is fully NULL and does not contain leftover flags (such as MEM_Ephem) from its previous use. Fix for ticket [43107840f1c02]. This is a cherrypick of check-in [24780f8ddc1683fc]. check-in: 304ea6ba user: drh tags: branch-3.8.7
01:07
Call fsync() right after ftruncate() when in journal_mode=TRUNCATE and when synchronous=FULL in order to ensure that transactions are durable across a power loss that happens moments after the commit. Proposed fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1072773. This is a cherrypick of [3e922208b68563489]. check-in: a8f9bd1e user: drh tags: branch-3.8.7
00:58
In the OP_Column opcode, when extracting a field that is past the end of a short record (because the row was originally inserted prior to ALTER TABLE ADD COLUMN) then make sure the output register is fully NULL and does not contain leftover flags (such as MEM_Ephem) from its previous use. Fix for ticket [43107840f1c02]. check-in: 24780f8d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/vdbe.c.

  2437   2437       ** still not up to p2, that means that the record has fewer than p2
  2438   2438       ** columns.  So the result will be either the default value or a NULL.
  2439   2439       */
  2440   2440       if( pC->nHdrParsed<=p2 ){
  2441   2441         if( pOp->p4type==P4_MEM ){
  2442   2442           sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static);
  2443   2443         }else{
  2444         -        MemSetTypeFlag(pDest, MEM_Null);
         2444  +        sqlite3VdbeMemSetNull(pDest);
  2445   2445         }
  2446   2446         goto op_column_out;
  2447   2447       }
  2448   2448     }
  2449   2449   
  2450   2450     /* Extract the content for the p2+1-th column.  Control can only
  2451   2451     ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are

Changes to test/update.test.

   600    600     catchsql {
   601    601       UPDATE t4 SET a=1;
   602    602     }
   603    603   } {1 {no such column: nosuchcol}}
   604    604   
   605    605   } ;# ifcapable {trigger}
   606    606   
          607  +# Ticket [https://www.sqlite.org/src/tktview/43107840f1c02] on 2014-10-29
          608  +# An assertion fault on UPDATE
          609  +#
          610  +do_execsql_test update-15.1 {
          611  +  CREATE TABLE t15(a INTEGER PRIMARY KEY, b);
          612  +  INSERT INTO t15(a,b) VALUES(10,'abc'),(20,'def'),(30,'ghi');
          613  +  ALTER TABLE t15 ADD COLUMN c;
          614  +  CREATE INDEX t15c ON t15(c);
          615  +  INSERT INTO t15(a,b)
          616  +   VALUES(5,'zyx'),(15,'wvu'),(25,'tsr'),(35,'qpo');
          617  +  UPDATE t15 SET c=printf("y%d",a) WHERE c IS NULL;
          618  +  SELECT a,b,c,'|' FROM t15 ORDER BY a;
          619  +} {5 zyx y5 | 10 abc y10 | 15 wvu y15 | 20 def y20 | 25 tsr y25 | 30 ghi y30 | 35 qpo y35 |}
          620  +
   607    621   
   608    622   finish_test