/ Check-in [a596b7c6]
Login

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

Overview
Comment:Do not set MEM_Blob unless the appropriate fields of the Mem object have been correctly initialized.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a596b7c6cc780525120604090493f3f7d962b9fa
User & Date: drh 2016-10-05 15:02:00
References
2016-10-05
15:04
Add a test case for the fix in [a596b7c6cc]. check-in: b2ef39b1 user: dan tags: trunk
Context
2016-10-05
15:04
Add a test case for the fix in [a596b7c6cc]. check-in: b2ef39b1 user: dan tags: trunk
15:02
Do not set MEM_Blob unless the appropriate fields of the Mem object have been correctly initialized. check-in: a596b7c6 user: drh tags: trunk
01:33
Fix the backup_malloc.test script so that it works on Windows. check-in: d080012d user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbemem.c.

589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
void sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){
  if( pMem->flags & MEM_Null ) return;
  switch( aff ){
    case SQLITE_AFF_BLOB: {   /* Really a cast to BLOB */
      if( (pMem->flags & MEM_Blob)==0 ){
        sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
        assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
        MemSetTypeFlag(pMem, MEM_Blob);
      }else{
        pMem->flags &= ~(MEM_TypeMask&~MEM_Blob);
      }
      break;
    }
    case SQLITE_AFF_NUMERIC: {
      sqlite3VdbeMemNumerify(pMem);







|







589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
void sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){
  if( pMem->flags & MEM_Null ) return;
  switch( aff ){
    case SQLITE_AFF_BLOB: {   /* Really a cast to BLOB */
      if( (pMem->flags & MEM_Blob)==0 ){
        sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
        assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
        if( pMem->flags & MEM_Str ) MemSetTypeFlag(pMem, MEM_Blob);
      }else{
        pMem->flags &= ~(MEM_TypeMask&~MEM_Blob);
      }
      break;
    }
    case SQLITE_AFF_NUMERIC: {
      sqlite3VdbeMemNumerify(pMem);