-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Add\sa\stest\scase\sto\scover\scode\sthat\swas\sleft\suntested\sby\sthe\sjournal_mode\nsimplification.
-D 2010-07-08T19:19:51
+C Reformat\sWAL\scode\sfor\sclearer\spresentation.\s\sUpdate\scomments\sfor\scorrectness.\nAdd\schecks\sto\sensure\sthat\scorruption\sin\sshared-memory\sdoes\snot\sresult\sin\nan\sinfinite\sloop.
+D 2010-07-09T03:19:07
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c4270a1cd7cd70a263b7e96a258aa90e9c3618eb
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
-F src/wal.c 5a58352aee4fb0546f4b94f8527a06300531bae9
+F src/wal.c 0cd5cd46df9237671def76abaf8152af4bd4128e
F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 926c83c6394e132a1c62b6b12ceeba7d55a34c19
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P aef26438523bccf1ea2c19205cd05799e4c69a1f
-R 95f7318feaa66a8b78205d887e6d1438
+P bcdddba4f011cf008d29918bcac59131007a8138
+R 5e19b5fcbb0a4bb30775e5e30106627d
U drh
-Z 04e790b790d53c3d8a934d95e1981b36
+Z 4cec72d41693a1e955d49c74ad6f997b
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFMNiTboxKgR168RlERAkDBAJ0RhukLRTBMs1DtkngKJab4oKQ5ywCgg48P
-LJSpxRhRYLMurIbiJuDHwuo=
-=eiHk
+iD8DBQFMNpUuoxKgR168RlERAq/pAJ97NzUyxw7J6MN7JJON213vZ349xQCeOtGo
+gYdze9fjpunjGvwfhDWNebg=
+=jEhp
-----END PGP SIGNATURE-----
/* Enlarge the pWal->apWiData[] array if required */
if( pWal->nWiData<=iPage ){
- int nByte = sizeof(u32 *)*(iPage+1);
+ int nByte = sizeof(u32*)*(iPage+1);
volatile u32 **apNew;
apNew = (volatile u32 **)sqlite3_realloc((void *)pWal->apWiData, nByte);
if( !apNew ){
*ppPage = 0;
return SQLITE_NOMEM;
}
- memset((void *)&apNew[pWal->nWiData], 0, sizeof(u32 *)*(iPage+1-pWal->nWiData));
+ memset((void*)&apNew[pWal->nWiData], 0,
+ sizeof(u32*)*(iPage+1-pWal->nWiData));
pWal->apWiData = apNew;
pWal->nWiData = iPage+1;
}
return 0;
}
- /* A frame is only valid if a checksum of the first 16 bytes
- ** of the frame-header, and the frame-data matches
- ** the checksum in the last 8 bytes of the frame-header.
+ /* A frame is only valid if a checksum of the WAL header,
+ ** all prior frams, the first 16 bytes of this frame-header,
+ ** and the frame-data matches the checksum in the last 8
+ ** bytes of this frame-header.
*/
nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
if( rc==SQLITE_OK ){
int iKey; /* Hash table key */
int idx; /* Value to write to hash-table slot */
- TESTONLY( int nCollide = 0; /* Number of hash collisions */ )
+ int nCollide; /* Number of hash collisions */
idx = iFrame - iZero;
assert( idx <= HASHTABLE_NSLOT/2 + 1 );
}
/* Write the aPgno[] array entry and the hash-table slot. */
+ nCollide = idx;
for(iKey=walHash(iPage); aHash[iKey]; iKey=walNextHash(iKey)){
- assert( nCollide++ < idx );
+ if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT;
}
aPgno[idx] = iPage;
aHash[iKey] = (ht_slot)idx;
ht_slot *aIndex; /* Sorted index for this segment */
aPgno++;
- nEntry = (int)(((i+1)==nSegment)?(int)(iLast-iZero):(u32 *)aHash-(u32 *)aPgno);
+ if( (i+1)==nSegment ){
+ nEntry = (int)(iLast - iZero);
+ }else{
+ nEntry = (u32*)aHash - (u32*)aPgno;
+ }
aIndex = &((ht_slot *)&p->aSegment[p->nSegment])[iZero];
iZero++;
volatile u32 *aPgno; /* Pointer to array of page numbers */
u32 iZero; /* Frame number corresponding to aPgno[0] */
int iKey; /* Hash slot index */
- int rc;
+ int nCollide; /* Number of hash collisions remaining */
+ int rc; /* Error code */
rc = walHashGet(pWal, iHash, &aHash, &aPgno, &iZero);
if( rc!=SQLITE_OK ){
return rc;
}
+ nCollide = HASHTABLE_NSLOT;
for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){
u32 iFrame = aHash[iKey] + iZero;
if( iFrame<=iLast && aPgno[aHash[iKey]]==pgno ){
assert( iFrame>iRead );
iRead = iFrame;
}
+ if( (nCollide--)==0 ){
+ return SQLITE_CORRUPT_BKPT;
+ }
}
}