On Tue, 11 Jan 2005, Gary Setter wrote: > In the suggest module, Wording class we use the ObjStack buffer > member to accumulate a suggestion (aka nearmiss). See functions > form_word, try_word_n, and try_word_c. We append to buffer more > then once. We assume that the size of the buffer is the end of > the last memory location allocated minus the start of the first > memory allocation. That will fail when one of the appends results > in a reallocation due to exceeding the memory available in the > current block. > > I haven't desided what to do. I may suggest a patch that uses the > String class to accumulate the suggestion, since ObjStack doesn't > seem to be a good choice for the task at hand.
No need for anything that drastic. Attached is a patch to fix the problem. -- http://kevin.atkinson.dhs.org
Index: modules/speller/default/suggest.cpp =================================================================== RCS file: /cvsroot/aspell/aspell/modules/speller/default/suggest.cpp,v retrieving revision 1.57 diff -u -r1.57 suggest.cpp --- modules/speller/default/suggest.cpp 23 Dec 2004 04:43:12 -0000 1.57 +++ modules/speller/default/suggest.cpp 11 Jan 2005 20:54:35 -0000 @@ -411,8 +411,9 @@ CheckInfo ci; memset(&ci, 0, sizeof(ci)); bool res = lang->affix()->affix_check(LookupInfo(sp, LookupInfo::Clean), str, ci, 0); if (!res) return; - char * tmp = form_word(ci); + form_word(ci); char * end = (char *)buffer.grow_temp(1); + char * tmp = (char *)buffer.temp_ptr(); *end = '\0'; add_nearmiss(tmp, end - tmp, 0, 0, score, -1, do_count); } @@ -475,6 +476,7 @@ t[0] = lang->to_lower(t[0]); } char * end = (char *)buffer.grow_temp(1); + tmp = (char *)buffer.temp_ptr(); // since the orignal string may of moved *end = 0; buffer.commit_temp(); add_nearmiss(tmp, end - tmp, 0, 0, score, -1, do_count);
_______________________________________________ Aspell-devel mailing list Aspell-devel@gnu.org http://lists.gnu.org/mailman/listinfo/aspell-devel