/ Check-in [9b5d4088]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a problem caused by a small SQLITE_LIMIT_LENGTH value and a CREATE TABLE with a very large name.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | toobig-fix
Files: files | file ages | folders
SHA3-256: 9b5d408864920b302f2d21abcae1d90f1e0cd68b18262136554ba0e6219d6025
User & Date: dan 2019-04-09 20:50:44
Context
2019-04-09
21:37
New test case for SQLITE_TOOBIG errors. check-in: 4c77fbbe user: drh tags: trunk
20:50
Fix a problem caused by a small SQLITE_LIMIT_LENGTH value and a CREATE TABLE with a very large name. Closed-Leaf check-in: 9b5d4088 user: dan tags: toobig-fix
01:26
Use an unsigned integer to count free pages in btree.c:freePage2(). check-in: 88204085 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  3218   3218       }
  3219   3219     }else{
  3220   3220       int n;
  3221   3221       Index *pLoop;
  3222   3222       for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
  3223   3223       zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n);
  3224   3224       if( zName==0 ){
         3225  +      if( db->mallocFailed==0 ) pParse->rc = SQLITE_TOOBIG;
         3226  +      pParse->nErr++;
  3225   3227         goto exit_create_index;
  3226   3228       }
  3227   3229   
  3228   3230       /* Automatic index names generated from within sqlite3_declare_vtab()
  3229   3231       ** must have names that are distinct from normal automatic index names.
  3230   3232       ** The following statement converts "sqlite3_autoindex..." into
  3231   3233       ** "sqlite3_butoindex..." in order to make the names distinct.

Changes to test/sqllimits1.test.

   885    885     ))))
   886    886   } "1 {too many columns in result set}"
   887    887   
   888    888   
   889    889   foreach {key value} [array get saved] {
   890    890     catch {set $key $value}
   891    891   }
          892  +
          893  +#-------------------------------------------------------------------------
          894  +# At one point the following caused an assert() to fail.
          895  +#
          896  +sqlite3_limit db SQLITE_LIMIT_LENGTH 10000
          897  +set nm [string repeat x 10000]
          898  +do_catchsql_test sqllimits1-17.1 "
          899  +  CREATE TABLE $nm (x PRIMARY KEY)
          900  +" {1 {string or blob too big}}
          901  +
   892    902   finish_test