/ Check-in [0798c91a]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Enable API armor handling for the new deserialize APIs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0798c91aa9d5d347680a9d80d420224297360e03341365d48aca829cd7c423db
User & Date: mistachkin 2018-03-08 19:56:52
Context
2018-03-09
12:46
Attempt to fix a harmless compiler warning from Clang. check-in: bba1bfbd user: drh tags: trunk
2018-03-08
19:56
Enable API armor handling for the new deserialize APIs. check-in: 0798c91a user: mistachkin tags: trunk
18:14
Add the --append and --zip options of the CLI to the --help message. check-in: f010c86e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/memdb.c.

   445    445     Btree *pBt;
   446    446     sqlite3_int64 sz;
   447    447     int szPage = 0;
   448    448     sqlite3_stmt *pStmt = 0;
   449    449     unsigned char *pOut;
   450    450     char *zSql;
   451    451     int rc;
          452  +
          453  +#ifdef SQLITE_ENABLE_API_ARMOR
          454  +  if( !sqlite3SafetyCheckOk(db) ){
          455  +    (void)SQLITE_MISUSE_BKPT;
          456  +    return 0;
          457  +  }
          458  +#endif
   452    459   
   453    460     if( zSchema==0 ) zSchema = db->aDb[0].zDbSName;
   454    461     p = memdbFromDbSchema(db, zSchema);
   455    462     iDb = sqlite3FindDbName(db, zSchema);
   456    463     if( piSize ) *piSize = -1;
   457    464     if( iDb<0 ) return 0;
   458    465     if( p ){
................................................................................
   515    522     unsigned mFlags         /* Zero or more SQLITE_DESERIALIZE_* flags */
   516    523   ){
   517    524     MemFile *p;
   518    525     char *zSql;
   519    526     sqlite3_stmt *pStmt = 0;
   520    527     int rc;
   521    528     int iDb;
          529  +
          530  +#ifdef SQLITE_ENABLE_API_ARMOR
          531  +  if( !sqlite3SafetyCheckOk(db) ){
          532  +    return SQLITE_MISUSE_BKPT;
          533  +  }
          534  +  if( szDb<0 ) return SQLITE_MISUSE_BKPT;
          535  +  if( szBuf<0 ) return SQLITE_MISUSE_BKPT;
          536  +#endif
   522    537   
   523    538     sqlite3_mutex_enter(db->mutex);
   524    539     if( zSchema==0 ) zSchema = db->aDb[0].zDbSName;
   525    540     iDb = sqlite3FindDbName(db, zSchema);
   526    541     if( iDb<0 ){
   527    542       rc = SQLITE_ERROR;
   528    543       goto end_deserialize;