1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

When doing the sqlite3BtreeInsert() overwrite optimization, make sure the

memcpy() does not extend off the end of the page.

FossilOrigin-Name: 684ef4582ed19b2af22dda6fc085c70464f92f1b
This commit is contained in:
drh
2016-12-09 19:42:18 +00:00
parent f923825424
commit 2d08343a91
3 changed files with 8 additions and 7 deletions

View File

@@ -8068,6 +8068,7 @@ int sqlite3BtreeInsert(
** doing that is no faster then skipping this optimization and just
** calling dropCell() and insertCell(). */
assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */
if( oldCell+szNew > pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;
memcpy(oldCell, newCell, szNew);
return SQLITE_OK;
}