Bug 626195 - Hunspell topcrash [@ AffixMgr::suffix_check ]. r=ehsan, a=blocking-final+
authorNémeth László <nemeth@openoffice.org>
Wed, 02 Feb 2011 13:42:46 -0500
changeset 61791 5947cd7a6ca2af3febf77c63f8cd1d68ffa0eca8
parent 61790 4753f5a91e75c9bfed45c35e7b699853d1784582
child 61792 4eb9e146d2304d06e2df85dc01d0b0eb24bb2495
push idunknown
push userunknown
push dateunknown
reviewersehsan, blocking-final
bugs626195
milestone2.0b12pre
Bug 626195 - Hunspell topcrash [@ AffixMgr::suffix_check ]. r=ehsan, a=blocking-final+
extensions/spellcheck/hunspell/src/README.hunspell
extensions/spellcheck/hunspell/src/affixmgr.cpp
--- a/extensions/spellcheck/hunspell/src/README.hunspell
+++ b/extensions/spellcheck/hunspell/src/README.hunspell
@@ -31,17 +31,17 @@
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 ******* END LICENSE BLOCK *******
 
 Hunspell Version: 1.2.12
-Additional Patches: 583582
+Additional Patches: 583582, 586671, 586686, 603311, 617953, 626195
 
 Hunspell Author: László Németh
 MySpell Author: Kevin Hendricks & David Einstein
 
 Hunspell is a spell checker and morphological analyser library. Hunspell
 is based on OpenOffice.org's Myspell. Documentation, tests, and examples
 are available at http://hunspell.sourceforge.net.
 
--- a/extensions/spellcheck/hunspell/src/affixmgr.cpp
+++ b/extensions/spellcheck/hunspell/src/affixmgr.cpp
@@ -2471,18 +2471,19 @@ struct hentry * AffixMgr::suffix_check (
                 if (rv) {
                     sfx=se; // BUG: sfx not stateless
                     return rv;
                 }
             }
         }
        se = se->getNext();
     }
-  
+
     // now handle the general case
+    if (len == 0) return NULL; // FULLSTRIP
     unsigned char sp = *((const unsigned char *)(word + len - 1));
     SfxEntry * sptr = sStart[sp];
 
     while (sptr) {
         if (isRevSubset(sptr->getKey(), word + len - 1, len)
         ) {
             // suffixes are not allowed in beginning of compounds
             if ((((in_compound != IN_CPD_BEGIN)) || // && !cclass
@@ -2538,18 +2539,19 @@ struct hentry * AffixMgr::suffix_check_t
     while (se) {
         if (contclasses[se->getFlag()])
         {
             rv = se->check_twosfx(word,len, sfxopts, ppfx, needflag);
             if (rv) return rv;
         }
         se = se->getNext();
     }
-  
+
     // now handle the general case
+    if (len == 0) return NULL; // FULLSTRIP
     unsigned char sp = *((const unsigned char *)(word + len - 1));
     SfxEntry * sptr = sStart[sp];
 
     while (sptr) {
         if (isRevSubset(sptr->getKey(), word + len - 1, len)) {
             if (contclasses[sptr->getFlag()])
             {
                 rv = sptr->check_twosfx(word,len, sfxopts, ppfx, needflag);
@@ -2600,18 +2602,19 @@ char * AffixMgr::suffix_check_twosfx_mor
                     mystrcat(result, " ", MAXLNLEN);
                     mystrcat(result, se->getMorph(), MAXLNLEN);
                 } else debugflag(result, se->getFlag());
                 mystrcat(result, "\n", MAXLNLEN);
             }
         }
         se = se->getNext();
     }
-  
+
     // now handle the general case
+    if (len == 0) return NULL; // FULLSTRIP
     unsigned char sp = *((const unsigned char *)(word + len - 1));
     SfxEntry * sptr = sStart[sp];
 
     while (sptr) {
         if (isRevSubset(sptr->getKey(), word + len - 1, len)) {
             if (contclasses[sptr->getFlag()]) 
             {
                 st = sptr->check_twosfx_morph(word,len, sfxopts, ppfx, needflag);
@@ -2706,18 +2709,19 @@ char * AffixMgr::suffix_check_morph(cons
                 mystrcat(result, se->getMorph(), MAXLNLEN);
             } else debugflag(result, se->getFlag());
             mystrcat(result, "\n", MAXLNLEN);
             rv = se->get_next_homonym(rv, sfxopts, ppfx, cclass, needflag);
          }
        }
        se = se->getNext();
     }
-  
+
     // now handle the general case
+    if (len == 0) return NULL; // FULLSTRIP
     unsigned char sp = *((const unsigned char *)(word + len - 1));
     SfxEntry * sptr = sStart[sp];
 
     while (sptr) {
         if (isRevSubset(sptr->getKey(), word + len - 1, len)
         ) {
             // suffixes are not allowed in beginning of compounds
             if (((((in_compound != IN_CPD_BEGIN)) || // && !cclass