1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Early detection out-of-bounds page numbers on the direct-overflow-read

optimization gives consistent error messages regardless of whether or not
the optimization is enabled.

FossilOrigin-Name: b517a52fa36df0a0854a75858b5e81861771d2e9032a5a0ad79aa76ae64130a2
This commit is contained in:
drh
2019-08-15 00:04:44 +00:00
parent 908e7c43a7
commit b9fc45534d
3 changed files with 8 additions and 7 deletions

View File

@@ -4879,6 +4879,7 @@ static int accessPayload(
assert( aWrite>=pBufStart ); /* due to (6) */
memcpy(aSave, aWrite, 4);
rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1));
if( rc && nextPage>pBt->nPage ) rc = SQLITE_CORRUPT_BKPT;
nextPage = get4byte(aWrite);
memcpy(aWrite, aSave, 4);
}else