SQLite

Check-in [5c34af7b97]
Login

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

Overview
Comment:Fix an off-by-one error in the dist3 algorithm of the spellfix extension.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5c34af7b975598bbe20751dfdd346f43031cb2bcb6b78f1bbdb2b51b398de182
User & Date: drh 2018-03-30 15:59:54.149
Context
2018-03-30
16:34
Fix a bug in the spellfix extension causing it to compute suboptimal answers. The problem was introduced by check-in [afd6fbc01052ccfc9]. (check-in: 3bf28fd9a7 user: drh tags: trunk)
15:59
Fix an off-by-one error in the dist3 algorithm of the spellfix extension. (check-in: 5c34af7b97 user: drh tags: trunk)
2018-03-29
16:54
Another change to test file zipfile.test to help it run on systems without "unzip". (check-in: b6252feb12 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/misc/spellfix.c.
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
    int nTo = zTo ? sqlite3_column_bytes(pStmt, 2) : 0;
    int iCost = sqlite3_column_int(pStmt, 3);

    assert( zFrom!=0 || nFrom==0 );
    assert( zTo!=0 || nTo==0 );
    if( nFrom>100 || nTo>100 ) continue;
    if( iCost<0 ) continue;
    if( iCost>10000 ) continue;   /* Costs above 10K are considered infinite */
    if( pLang==0 || iLang!=iLangPrev ){
      EditDist3Lang *pNew;
      pNew = sqlite3_realloc64(p->a, (p->nLang+1)*sizeof(p->a[0]));
      if( pNew==0 ){ rc = SQLITE_NOMEM; break; }
      p->a = pNew;
      pLang = &p->a[p->nLang];
      p->nLang++;







|







760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
    int nTo = zTo ? sqlite3_column_bytes(pStmt, 2) : 0;
    int iCost = sqlite3_column_int(pStmt, 3);

    assert( zFrom!=0 || nFrom==0 );
    assert( zTo!=0 || nTo==0 );
    if( nFrom>100 || nTo>100 ) continue;
    if( iCost<0 ) continue;
    if( iCost>=10000 ) continue;  /* Costs above 10K are considered infinite */
    if( pLang==0 || iLang!=iLangPrev ){
      EditDist3Lang *pNew;
      pNew = sqlite3_realloc64(p->a, (p->nLang+1)*sizeof(p->a[0]));
      if( pNew==0 ){ rc = SQLITE_NOMEM; break; }
      p->a = pNew;
      pLang = &p->a[p->nLang];
      p->nLang++;