SQLite

Check-in [4249fcf7b0]
Login

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

Overview
Comment:Fix a problem with handling SQLITE_FCNTL_MMAP_SIZE requests with a negative parameter in os_unix.c.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | mmap-size-limit
Files: files | file ages | folders
SHA3-256: 4249fcf7b0c0233f9b3ba5139702738d5221c5309240e6e91dc139eff59471fe
User & Date: dan 2017-08-07 18:54:10.201
Context
2017-08-07
19:06
On Windows, avoid casting a value larger than 2^31 to a (SIZE_T) on systems where it is a 32-bit type. (Leaf check-in: f08d63b413 user: mistachkin tags: mmap-size-limit)
18:54
Fix a problem with handling SQLITE_FCNTL_MMAP_SIZE requests with a negative parameter in os_unix.c. (check-in: 4249fcf7b0 user: dan tags: mmap-size-limit)
18:27
Update bigmmap.test to account for builds that use "-DSQLITE_MAX_MMAP_SIZE=<integer-constant>LL". (check-in: 7c8b6f1cac user: dan tags: mmap-size-limit)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
      int rc = SQLITE_OK;
      if( newLimit>sqlite3GlobalConfig.mxMmap ){
        newLimit = sqlite3GlobalConfig.mxMmap;
      }

      /* The value of newLimit may be eventually cast to (size_t) and passed
      ** to mmap(). Restrict its value to 2GB if (size_t) is a 32-bit type. */
      if( sizeof(size_t)<8 ){
        newLimit = (newLimit & 0x7FFFFFFF);
      }

      *(i64*)pArg = pFile->mmapSizeMax;
      if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
        pFile->mmapSizeMax = newLimit;
        if( pFile->mmapSize>0 ){







|







3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
      int rc = SQLITE_OK;
      if( newLimit>sqlite3GlobalConfig.mxMmap ){
        newLimit = sqlite3GlobalConfig.mxMmap;
      }

      /* The value of newLimit may be eventually cast to (size_t) and passed
      ** to mmap(). Restrict its value to 2GB if (size_t) is a 32-bit type. */
      if( newLimit>0 && sizeof(size_t)<8 ){
        newLimit = (newLimit & 0x7FFFFFFF);
      }

      *(i64*)pArg = pFile->mmapSizeMax;
      if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
        pFile->mmapSizeMax = newLimit;
        if( pFile->mmapSize>0 ){