Index: src/build.c ================================================================== --- src/build.c +++ src/build.c @@ -3220,10 +3220,12 @@ int n; Index *pLoop; for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){} zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n); if( zName==0 ){ + if( db->mallocFailed==0 ) pParse->rc = SQLITE_TOOBIG; + pParse->nErr++; goto exit_create_index; } /* Automatic index names generated from within sqlite3_declare_vtab() ** must have names that are distinct from normal automatic index names. Index: test/sqllimits1.test ================================================================== --- test/sqllimits1.test +++ test/sqllimits1.test @@ -887,6 +887,16 @@ foreach {key value} [array get saved] { catch {set $key $value} } + +#------------------------------------------------------------------------- +# At one point the following caused an assert() to fail. +# +sqlite3_limit db SQLITE_LIMIT_LENGTH 10000 +set nm [string repeat x 10000] +do_catchsql_test sqllimits1-17.1 " + CREATE TABLE $nm (x PRIMARY KEY) +" {1 {string or blob too big}} + finish_test