From: drh Date: Sat, 21 Aug 2010 15:09:37 +0000 (+0000) Subject: Fix the ptrmapPageno() routine so that it works correctly for an input of 1. X-Git-Tag: version-3.7.2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f77b2e0eaabec550766c8d547aef1ed31b3b12f;p=thirdparty%2Fsqlite.git Fix the ptrmapPageno() routine so that it works correctly for an input of 1. FossilOrigin-Name: 699a9bf28377f43f58c509878cce60cb906dbf48 --- diff --git a/manifest b/manifest index 46e650350e..3d0ba1027a 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Do\snot\sallow\sa\sbackup\sto\schange\sthe\spage\ssize\sif\sa\scodec\sis\sin\suse. -D 2010-08-20T15:32:21 +C Fix\sthe\sptrmapPageno()\sroutine\sso\sthat\sit\sworks\scorrectly\sfor\san\sinput\sof\s1. +D 2010-08-21T15:09:37 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -116,7 +116,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c 8ff0b7018df253c7f30d3f9702b0b16f19209d5c F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff -F src/btree.c 69942b33b4ed4e0cc9a36b18a288839293528267 +F src/btree.c 2dff4076d3c994dc1954ec7c1792febd49e13631 F src/btree.h b4ba2fdf6b64c7c376bdfffa826af6b786b151d9 F src/btreeInt.h 5b034ff54800046cc5870605d683ac1f9134bd99 F src/build.c 0018d49629fc4807100c988dd191dd95e185bb38 @@ -848,14 +848,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 6a0cbb272c3f0c1dfdeed381ba92f2f2f16ae824 -R 4d947b2be8e528f5b1f57b6ae25bb254 +P 5523ecd32295c188e3bf5dbd57d92d2879461e32 +R dc568dd5438d0cab5b031335b05c73a5 U drh -Z a5dd11d4db14995185bd3cc381bc0177 +Z 4fafdd21c95475ac900afea2d119affc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMbqAJoxKgR168RlERAtWjAJsGkTB7PoEEAyEHc28sHL4Q6xG9XQCghnJH -TrSCzzZw80Uns0M1vpEzqWw= -=GSse +iD8DBQFMb+w3oxKgR168RlERAu8pAJ9xUYJ2vVngElJD9AJ0FdpZF4d/kACaA0pc +mVGOV+o62jEkChLiO5Bqu4Q= +=8+AE -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 607ea43f07..ca679bdeb9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5523ecd32295c188e3bf5dbd57d92d2879461e32 \ No newline at end of file +699a9bf28377f43f58c509878cce60cb906dbf48 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index f6110a9110..83a0fed5fd 100644 --- a/src/btree.c +++ b/src/btree.c @@ -730,11 +730,16 @@ int sqlite3BtreeCursorHasMoved(BtCursor *pCur, int *pHasMoved){ ** Given a page number of a regular database page, return the page ** number for the pointer-map page that contains the entry for the ** input page number. +** +** Return 0 (not a valid page) for pgno==1 since there is +** no pointer map associated with page 1. The integrity_check logic +** requires that ptrmapPageno(*,1)!=1. */ static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){ int nPagesPerMapPage; Pgno iPtrMap, ret; assert( sqlite3_mutex_held(pBt->mutex) ); + if( pgno<2 ) return 0; nPagesPerMapPage = (pBt->usableSize/5)+1; iPtrMap = (pgno-2)/nPagesPerMapPage; ret = (iPtrMap*nPagesPerMapPage) + 2;