File sqlite3-journal-file.patch of Package sqlite3.12511
--- sqlite3.c.orig
+++ sqlite3.c
@@ -80963,6 +80963,7 @@ static int memjrnlRead(
/* SQLite never tries to read past the end of a rollback journal file */
assert( iOfst+iAmt<=p->endpoint.iOffset );
+ assert( p->readpoint.iOffset==0 || p->readpoint.pChunk!=0 );
if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
sqlite3_int64 iOff = 0;
@@ -80974,6 +80975,7 @@ static int memjrnlRead(
}
}else{
pChunk = p->readpoint.pChunk;
+ assert( pChunk!=0 );
}
iChunkOffset = (int)(iOfst%JOURNAL_CHUNKSIZE);
@@ -80985,7 +80987,7 @@ static int memjrnlRead(
nRead -= iSpace;
iChunkOffset = 0;
} while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
- p->readpoint.iOffset = iOfst+iAmt;
+ p->readpoint.iOffset = pChunk ? iOfst+iAmt : 0;
p->readpoint.pChunk = pChunk;
return SQLITE_OK;