On Windows, avoid casting a value larger than 2^31 to a (SIZE_T) on systems where it is a 32-bit type.
FossilOrigin-Name: f08d63b413601b22726e8b96ff8eb779857321b9df30db0333f71e50ffb5077d
This commit is contained in:
parent
089df50687
commit
e35395a45a
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sa\sproblem\swith\shandling\sSQLITE_FCNTL_MMAP_SIZE\srequests\swith\sa\snegative\nparameter\sin\sos_unix.c.
|
||||
D 2017-08-07T18:54:10.201
|
||||
C On\sWindows,\savoid\scasting\sa\svalue\slarger\sthan\s2^31\sto\sa\s(SIZE_T)\son\ssystems\swhere\sit\sis\sa\s32-bit\stype.
|
||||
D 2017-08-07T19:06:54.041
|
||||
F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016
|
||||
@ -436,8 +436,8 @@ F src/os.c add02933b1dce7a39a005b00a2f5364b763e9a24
|
||||
F src/os.h 8e976e59eb4ca1c0fca6d35ee803e38951cb0343
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c 47b6c1e501902272fa23f1356e1048bcdfa89b9974a664612e4ad018a16bf533
|
||||
F src/os_win.c 2a6c73eef01c51a048cc4ddccd57f981afbec18a
|
||||
F src/os_unix.c a361273749229755f92c8f0e3e4855054ad39bbc5c65773e8db5d0b79afa632c
|
||||
F src/os_win.c 964165b66cde03abc72fe948198b01be608436894732eadb94c8720d2467f223
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 1e63b0299cf123cf38c48413ec03190f56c1e7d0ccc6573c467d8ac240b898e9
|
||||
F src/pager.h f2a99646c5533ffe11afa43e9e0bea74054e4efa
|
||||
@ -1644,7 +1644,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 7c8b6f1cace42ee1182c252c8e66e5679f523f4248c27d38c075ae21e7c25374
|
||||
R 798f9b25fca6a2710c43590a6d82bf28
|
||||
U dan
|
||||
Z 6e6dcb1a7a4b333e27c902b697e4e4b3
|
||||
P 4249fcf7b0c0233f9b3ba5139702738d5221c5309240e6e91dc139eff59471fe
|
||||
R ada1495a3f5fb5efd255ea78a3bbd776
|
||||
U mistachkin
|
||||
Z fa32878e56ea1fef6300b9cb2bae7ccb
|
||||
|
@ -1 +1 @@
|
||||
4249fcf7b0c0233f9b3ba5139702738d5221c5309240e6e91dc139eff59471fe
|
||||
f08d63b413601b22726e8b96ff8eb779857321b9df30db0333f71e50ffb5077d
|
@ -3860,7 +3860,8 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
** to mmap(). Restrict its value to 2GB if (size_t) is not at least a
|
||||
** 64-bit type. */
|
||||
if( newLimit>0 && sizeof(size_t)<8 ){
|
||||
newLimit = (newLimit & 0x7FFFFFFF);
|
||||
}
|
||||
|
@ -3559,6 +3559,14 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
if( newLimit>sqlite3GlobalConfig.mxMmap ){
|
||||
newLimit = sqlite3GlobalConfig.mxMmap;
|
||||
}
|
||||
|
||||
/* The value of newLimit may be eventually cast to (SIZE_T) and passed
|
||||
** to MapViewOfFile(). Restrict its value to 2GB if (SIZE_T) is not at
|
||||
** least a 64-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;
|
||||
|
Loading…
Reference in New Issue
Block a user