SQLite

Check-in [a596b7c6cc]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a596b7c6cc780525120604090493f3f7d962b9fa
User & Date: drh 2016-10-05 15:02:00.449
References
2016-10-05
15:04
Add a test case for the fix in [a596b7c6cc]. (check-in: b2ef39b11f user: dan tags: trunk)
Context
2016-10-05
15:04
Add a test case for the fix in [a596b7c6cc]. (check-in: b2ef39b11f 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: a596b7c6cc user: drh tags: trunk)
01:33
Fix the backup_malloc.test script so that it works on Windows. (check-in: d080012daa user: drh tags: trunk)
Changes
Unified Diff 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);