Fossil: Check-in [20abe25963]

Fossil SCM

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

Overview
Comment:Pedantic cleanup to how to the SQL compress()/decompress() UDFs report an OOM, which can happen via zlib, outside of fossil's fail-fast allocator.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:20abe259639742fa8ae9519f070c4b850f34f54345ad300218a5d2ba5c70fce5
User & Date: stephan 2019-05-28 18:43:16
Context
2019-05-28
20:51
Add the login-group command for managing login groups from the command-line. check-in: c3ba504d5c user: drh tags: trunk
18:43
Pedantic cleanup to how to the SQL compress()/decompress() UDFs report an OOM, which can happen via zlib, outside of fossil's fail-fast allocator. check-in: 20abe25963 user: stephan tags: trunk
2019-05-27
11:17
Fix a memory leak in the delta_parse() table-valued function, pointed out by Ralf Junkers. check-in: 9002a80ad6 user: drh tags: trunk
Changes

Changes to src/sqlcmd.c.

    82     82     pOut[0] = nIn>>24 & 0xff;
    83     83     pOut[1] = nIn>>16 & 0xff;
    84     84     pOut[2] = nIn>>8 & 0xff;
    85     85     pOut[3] = nIn & 0xff;
    86     86     rc = compress(&pOut[4], &nOut, pIn, nIn);
    87     87     if( rc==Z_OK ){
    88     88       sqlite3_result_blob(context, pOut, nOut+4, sqlite3_free);
           89  +  }else if( rc==Z_MEM_ERROR ){
           90  +    sqlite3_free(pOut);
           91  +    sqlite3_result_error_nomem(context);
    89     92     }else{
    90     93       sqlite3_free(pOut);
    91     94       sqlite3_result_error(context, "input cannot be zlib compressed", -1);
    92     95     }
    93     96   }
    94     97   
    95     98   /*
................................................................................
   111    114     pIn = sqlite3_value_blob(argv[0]);
   112    115     nIn = sqlite3_value_bytes(argv[0]);
   113    116     nOut = (pIn[0]<<24) + (pIn[1]<<16) + (pIn[2]<<8) + pIn[3];
   114    117     pOut = sqlite3_malloc( nOut+1 );
   115    118     rc = uncompress(pOut, &nOut, &pIn[4], nIn-4);
   116    119     if( rc==Z_OK ){
   117    120       sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
          121  +  }else if( rc==Z_MEM_ERROR ){
          122  +    sqlite3_free(pOut);
          123  +    sqlite3_result_error_nomem(context);
   118    124     }else{
   119    125       sqlite3_free(pOut);
   120    126       sqlite3_result_error(context, "input is not zlib compressed", -1);
   121    127     }
   122    128   }
   123    129   
   124    130   /*