/ Check-in [2c1ef40e]
Login

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

Overview
Comment:Fix the xFetch method of the "memdb" VFS (used by deserialize) so that it is robust against corrupt database file.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dbsqlfuzz-in-fuzzcheck
Files: files | file ages | folders
SHA3-256: 2c1ef40e787a6bc355b50168527a47eb09acd30d0d88cff8336a434ad554115d
User & Date: drh 2019-01-25 14:16:01
Context
2019-01-25
14:23
Extend fuzzcheck so that it can process dbsqlfuzz cases. Add a collection of interesting dbsqlfuzz cases to the standard test suite. check-in: e2991a7e user: drh tags: trunk
14:16
Fix the xFetch method of the "memdb" VFS (used by deserialize) so that it is robust against corrupt database file. Closed-Leaf check-in: 2c1ef40e user: drh tags: dbsqlfuzz-in-fuzzcheck
13:03
In fuzzcheck, activate vdbe_debug for dbsqlfuzz cases when using the -vvvvv verbosity level or above. check-in: 2e6f7c2a user: drh tags: dbsqlfuzz-in-fuzzcheck
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/memdb.c.

   306    306   static int memdbFetch(
   307    307     sqlite3_file *pFile,
   308    308     sqlite3_int64 iOfst,
   309    309     int iAmt,
   310    310     void **pp
   311    311   ){
   312    312     MemFile *p = (MemFile *)pFile;
   313         -  p->nMmap++;
   314         -  *pp = (void*)(p->aData + iOfst);
          313  +  if( iOfst+iAmt>p->sz ){
          314  +    assert( CORRUPT_DB );
          315  +    *pp = 0;
          316  +  }else{
          317  +    p->nMmap++;
          318  +    *pp = (void*)(p->aData + iOfst);
          319  +  }
   315    320     return SQLITE_OK;
   316    321   }
   317    322   
   318    323   /* Release a memory-mapped page */
   319    324   static int memdbUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){
   320    325     MemFile *p = (MemFile *)pFile;
   321    326     p->nMmap--;