SQLite

Check-in [2c1ef40e78]
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
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.971
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: e2991a7ecf 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: 2c1ef40e78 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: 2e6f7c2ace user: drh tags: dbsqlfuzz-in-fuzzcheck)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/memdb.c.
306
307
308
309
310
311
312




313
314

315
316
317
318
319
320
321
static int memdbFetch(
  sqlite3_file *pFile,
  sqlite3_int64 iOfst,
  int iAmt,
  void **pp
){
  MemFile *p = (MemFile *)pFile;




  p->nMmap++;
  *pp = (void*)(p->aData + iOfst);

  return SQLITE_OK;
}

/* Release a memory-mapped page */
static int memdbUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){
  MemFile *p = (MemFile *)pFile;
  p->nMmap--;







>
>
>
>
|
|
>







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

/* Release a memory-mapped page */
static int memdbUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){
  MemFile *p = (MemFile *)pFile;
  p->nMmap--;