aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-01-21 23:18:22 +0000
committerdrh <drh@noemail.net>2019-01-21 23:18:22 +0000
commit87c3ad453781bbfbce6b78e1216a92d1687bddc1 (patch)
tree3fad94848577c09e6ed77de73117951c909a463d /src
parent129371553c0c543a26678a12680c484ea0e8ad09 (diff)
downloadsqlite-87c3ad453781bbfbce6b78e1216a92d1687bddc1.tar.gz
sqlite-87c3ad453781bbfbce6b78e1216a92d1687bddc1.zip
Enhance the btree search routine so that it does early detection of
impossibly large keys and thereby avoids a large malloc() call. FossilOrigin-Name: 3ecaaee69f49e43d38047b7d53b82689eba7f7d33541fcac3c32b6dc8a568458
Diffstat (limited to 'src')
-rw-r--r--src/btree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/btree.c b/src/btree.c
index bec3eebeb..c42f80f70 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -5475,7 +5475,7 @@ int sqlite3BtreeMovetoUnpacked(
testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */
testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */
testcase( nCell==2 ); /* Minimum legal index key size */
- if( nCell<2 ){
+ if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){
rc = SQLITE_CORRUPT_PAGE(pPage);
goto moveto_finish;
}