aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-03-31 21:09:33 +0000
committerdrh <drh@noemail.net>2019-03-31 21:09:33 +0000
commit8fe25c64f13a8e5d3ca44d003441a7353cd6aca2 (patch)
treef404e14c55c78ed1365872ba061a235490d7429c /src
parentce5752cd1f748e9449afc3fcfa6e1e9f1670d1e9 (diff)
downloadsqlite-8fe25c64f13a8e5d3ca44d003441a7353cd6aca2.tar.gz
sqlite-8fe25c64f13a8e5d3ca44d003441a7353cd6aca2.zip
Early detection of too many columns in an index avoid a possible 16-bit
signed integer overflow. FossilOrigin-Name: 8af0caeb6d1e55f66ad2f12af94845dccfe1d0420faf326f5917fc07f8aa6050
Diffstat (limited to 'src')
-rw-r--r--src/build.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/build.c b/src/build.c
index 0115727ee..77954d029 100644
--- a/src/build.c
+++ b/src/build.c
@@ -3265,6 +3265,7 @@ void sqlite3CreateIndex(
sqlite3ExprListSetSortOrder(pList, sortOrder);
}else{
sqlite3ExprListCheckLength(pParse, pList, "index");
+ if( pParse->nErr ) goto exit_create_index;
}
/* Figure out how many bytes of space are required to store explicitly
@@ -3283,6 +3284,7 @@ void sqlite3CreateIndex(
*/
nName = sqlite3Strlen30(zName);
nExtraCol = pPk ? pPk->nKeyCol : 1;
+ assert( pList->nExpr + nExtraCol <= 32767 /* Fits in i16 */ );
pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol,
nName + nExtra + 1, &zExtra);
if( db->mallocFailed ){