SQLite

Check-in [b9eccef782]
Login

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

Overview
Comment:Fix the SQLITE_DESERIALIZE_READONLY feature so that it does not cause an assertion fault in the pager.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b9eccef7825c61980678599358b62bc394283124653061ce163ead0c653f481d
User & Date: drh 2019-01-22 16:43:47.471
Context
2019-01-22
16:44
Use _strdup() instead of strdup() on Windows builds of the CLI, to avoid a compiler warning reported on the mailing list. (check-in: a7126a4f4f user: drh tags: trunk)
16:43
Fix the SQLITE_DESERIALIZE_READONLY feature so that it does not cause an assertion fault in the pager. (check-in: b9eccef782 user: drh tags: trunk)
16:11
Update dbfuzz2 to set a maximum database size of 100MiB by default, but with the new --max-db-size N option to change that limit. (check-in: 21d6bb78ef user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/memdb.c.
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
static int memdbWrite(
  sqlite3_file *pFile,
  const void *z,
  int iAmt,
  sqlite_int64 iOfst
){
  MemFile *p = (MemFile *)pFile;
  if( p->mFlags & SQLITE_DESERIALIZE_READONLY ) return SQLITE_READONLY;
  if( iOfst+iAmt>p->sz ){
    int rc;
    if( iOfst+iAmt>p->szAlloc
     && (rc = memdbEnlarge(p, iOfst+iAmt))!=SQLITE_OK
    ){
      return rc;
    }







|







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
static int memdbWrite(
  sqlite3_file *pFile,
  const void *z,
  int iAmt,
  sqlite_int64 iOfst
){
  MemFile *p = (MemFile *)pFile;
  if( NEVER(p->mFlags & SQLITE_DESERIALIZE_READONLY) ) return SQLITE_READONLY;
  if( iOfst+iAmt>p->sz ){
    int rc;
    if( iOfst+iAmt>p->szAlloc
     && (rc = memdbEnlarge(p, iOfst+iAmt))!=SQLITE_OK
    ){
      return rc;
    }
234
235
236
237
238
239
240





241
242
243
244
245
246
247
}

/*
** Lock an memdb-file.
*/
static int memdbLock(sqlite3_file *pFile, int eLock){
  MemFile *p = (MemFile *)pFile;





  p->eLock = eLock;
  return SQLITE_OK;
}

#if 0 /* Never used because memdbAccess() always returns false */
/*
** Check if another file-handle holds a RESERVED lock on an memdb-file.







>
>
>
>
>







234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
}

/*
** Lock an memdb-file.
*/
static int memdbLock(sqlite3_file *pFile, int eLock){
  MemFile *p = (MemFile *)pFile;
  if( eLock>SQLITE_LOCK_SHARED 
   && (p->mFlags & SQLITE_DESERIALIZE_READONLY)!=0
  ){
    return SQLITE_READONLY;
  }
  p->eLock = eLock;
  return SQLITE_OK;
}

#if 0 /* Never used because memdbAccess() always returns false */
/*
** Check if another file-handle holds a RESERVED lock on an memdb-file.