]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Cherry-pick the SQLITE_DIRECT_OVERFLOW_READ fix for ticket
authordrh <drh@noemail.net>
Wed, 21 Dec 2011 23:38:21 +0000 (23:38 +0000)
committerdrh <drh@noemail.net>
Wed, 21 Dec 2011 23:38:21 +0000 (23:38 +0000)
[ac0ff496b7e3] of changes [c5256b59ad] and [c723e3e18a]
into the nx-devkit branch.

FossilOrigin-Name: 42f31f190a0ac971fa0ee361fe4c175f479c75e3

manifest
manifest.uuid
src/btree.c
src/pager.c
src/test_journal.c
src/test_stat.c
test/bigfile2.test [new file with mode: 0644]

index 1257f0f4ca64f9311e88cfa34721190389e848fb..8348cbd8360533de335eb2fa6968c619eac2f79d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Tweaks\sto\sthe\sway\smultiplexSubOpen()\sworks,\sfor\sbackwards\scompatibility.
-D 2011-12-16T05:50:39.331
+C Cherry-pick\sthe\sSQLITE_DIRECT_OVERFLOW_READ\sfix\sfor\sticket\n[ac0ff496b7e3]\sof\schanges\s[c5256b59ad]\sand\s[c723e3e18a]\s\ninto\sthe\snx-devkit\sbranch.
+D 2011-12-21T23:38:21.467
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -125,7 +125,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
 F src/backup.c 4368158da74d4711888e03264105c5c527d76caf
 F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
 F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
-F src/btree.c 80ea65224512884bb72976c93810d2dcaecc1353
+F src/btree.c 2fdde7d16c80bd4e8a0913038e766c4297818f6f
 F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce
 F src/btreeInt.h ea863a819224d3e6845ad1e39954d41558b8cd8b
 F src/build.c 8915bb6d72ead998f94c2756ea8d143c77709b70
@@ -168,7 +168,7 @@ F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
 F src/os_unix.c baad28b27adc563579170b6d765af0b0cc1d98c8
 F src/os_win.c 823f55855ceb062d72231409b828d0486f09125f
-F src/pager.c d981f3bfcc0e4460537d983899620700ccf8f539
+F src/pager.c 6277bebe07ac45bc99fb912ec105f913be804a83
 F src/pager.h 5cd760857707529b403837d813d86b68938d6183
 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
 F src/pcache.c 1fdd77978c1525d1ca4b9ef48eb80abca710cb4c
@@ -211,7 +211,7 @@ F src/test_hexio.c c4773049603151704a6ab25ac5e936b5109caf5a
 F src/test_init.c 3cbad7ce525aec925f8fda2192d576d47f0d478a
 F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
 F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
-F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff
+F src/test_journal.c 2c06e4be6584d51b935dc8b353980a9388de62ef
 F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
 F src/test_malloc.c 8d416f29ad8573f32601f6056c9d2b17472e9ad5
 F src/test_multiplex.c 6e07b94e2fe430f7f4f0d7d67b5e58f504dea655
@@ -224,7 +224,7 @@ F src/test_quota.c ec7d1056936f69be953c343bcb480305ce8928f3
 F src/test_rtree.c 6d06306e29946dc36f528a3a2cdc3add794656f1
 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
 F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
-F src/test_stat.c 69de4361c7a69fc1136d31ab7144408cd00805c7
+F src/test_stat.c 80271ad7d776a79babe0e025bb3a1bfcd3a3cfb1
 F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
 F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
 F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
@@ -296,6 +296,7 @@ F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f
 F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f
 F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070
 F test/bigfile.test a8ec8073a20207456dab01a29ad9cde42b0dd103
+F test/bigfile2.test f8e83eca9abef60692a34255a2ebcb96aff897fc
 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
 F test/bind.test 3c7b320969000c441a70952b0b15938fbb66237c
 F test/bindxfer.test efecd12c580c14df5f4ad3b3e83c667744a4f7e0
@@ -978,7 +979,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 022bf427c2edfe494ec7c222f436953ff56574a6
-R 29ea54dcd671c93952fcbf93e86a1060
+P bb40338887c912be70cb6fe3b760d87c14bb88a5
+R 041cbd9cee36a582791819872d3229da
 U drh
-Z b9fbbc1fe20301c015fc0588c12a3621
+Z f97894b580cddabcc04be599aee7b3e7
index 6edf6058c33752d888c4a7b41e581e1ffedb31b3..81d4e3eee69fbe3571512ff70ecfe2ba2b135c59 100644 (file)
@@ -1 +1 @@
-bb40338887c912be70cb6fe3b760d87c14bb88a5
\ No newline at end of file
+42f31f190a0ac971fa0ee361fe4c175f479c75e3
\ No newline at end of file
index 713016e75639fe8a2d13619d08edc5211f79eae5..ad011608bf412655ab39d6c4b0c02e679a6d50a7 100644 (file)
@@ -3979,7 +3979,7 @@ static int accessPayload(
           u8 aSave[4];
           u8 *aWrite = &pBuf[-4];
           memcpy(aSave, aWrite, 4);
-          rc = sqlite3OsRead(fd, aWrite, a+4, pBt->pageSize * (nextPage-1));
+          rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1));
           nextPage = get4byte(aWrite);
           memcpy(aWrite, aSave, 4);
         }else
index f3069e52bad0a63568b2b71bc8e64c42491e9ca3..cc1648fb8f57e0a838f3e4ca0256c16c499668ae 100644 (file)
@@ -3267,13 +3267,13 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
   */
   if( pSavepoint ){
     u32 ii;            /* Loop counter */
-    i64 offset = pSavepoint->iSubRec*(4+pPager->pageSize);
+    i64 offset = (i64)pSavepoint->iSubRec*(4+pPager->pageSize);
 
     if( pagerUseWal(pPager) ){
       rc = sqlite3WalSavepointUndo(pPager->pWal, pSavepoint->aWalData);
     }
     for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && ii<pPager->nSubRec; ii++){
-      assert( offset==ii*(4+pPager->pageSize) );
+      assert( offset==(i64)ii*(4+pPager->pageSize) );
       rc = pager_playback_one_page(pPager, &offset, pDone, 0, 1);
     }
     assert( rc!=SQLITE_DONE );
@@ -4121,7 +4121,7 @@ static int subjournalPage(PgHdr *pPg){
     ** write the journal record into the file.  */
     if( rc==SQLITE_OK ){
       void *pData = pPg->pData;
-      i64 offset = pPager->nSubRec*(4+pPager->pageSize);
+      i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
       char *pData2;
   
       CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
index 68869723b3e2af7492fc828cc985b34cd387cb6c..ef82070320b2fe9af201ec1dcb0dadb71da51247 100644 (file)
@@ -391,7 +391,7 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){
     while( rc==SQLITE_OK && iTrunk>0 ){
       u32 nLeaf;
       u32 iLeaf;
-      sqlite3_int64 iOff = (iTrunk-1)*pMain->nPagesize;
+      sqlite3_int64 iOff = (i64)(iTrunk-1)*pMain->nPagesize;
       rc = sqlite3OsRead(p, aData, pMain->nPagesize, iOff);
       nLeaf = decodeUint32(&aData[4]);
       for(iLeaf=0; rc==SQLITE_OK && iLeaf<nLeaf; iLeaf++){
index ef8176904a232a18f4476d95de48523e9e8a734e..a0893b39747e186a8a89d59eedb88a429026d3c5 100644 (file)
@@ -369,7 +369,7 @@ static void statSizeAndOffset(StatCursor *pCsr){
 
   /* The default page size and offset */
   pCsr->szPage = sqlite3BtreeGetPageSize(pBt);
-  pCsr->iOffset = pCsr->szPage * (pCsr->iPageno - 1);
+  pCsr->iOffset = (i64)pCsr->szPage * (pCsr->iPageno - 1);
 
   /* If connected to a ZIPVFS backend, override the page size and
   ** offset with actual values obtained from ZIPVFS.
diff --git a/test/bigfile2.test b/test/bigfile2.test
new file mode 100644 (file)
index 0000000..9810d3a
--- /dev/null
@@ -0,0 +1,59 @@
+# 2011 December 20
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.  The
+# focus of this script testing the ability of SQLite to handle database
+# files larger than 4GB.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix bigfile2
+
+# Create a small database.
+#
+do_execsql_test 1.1 {
+  CREATE TABLE t1(a, b);
+  INSERT INTO t1 VALUES(1, 2);
+}
+
+# Pad the file out to 4GB in size. Then clear the file-size field in the
+# db header. This will cause SQLite to assume that the first 4GB of pages
+# are actually in use and new pages will be appended to the file.
+#
+db close
+if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} {
+  puts "**** Unable to create a file larger than 4096 MB. *****"
+  finish_test
+  return
+}
+hexio_write test.db 28 00000000
+
+do_test 1.2 {
+  file size test.db
+} [expr 14 + 4096 * (1<<20)]
+
+# Now insert a large row. The overflow pages will be located past the 4GB
+# boundary. Then, after opening and closing the database, test that the row
+# can be read back in. 
+# 
+set str [string repeat k 30000]
+do_test 1.3 {
+  sqlite3 db test.db
+  execsql { INSERT INTO t1 VALUES(3, $str) }
+  db close
+  sqlite3 db test.db
+  db one { SELECT b FROM t1 WHERE a = 3 }
+} $str
+
+db close
+file delete test.db
+
+finish_test