[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[aspell] Re: [aspell]Correction to Patch. Re: Fix for Major bug in aspel
From: |
Kevin Atkinson |
Subject: |
[aspell] Re: [aspell]Correction to Patch. Re: Fix for Major bug in aspell world length handling |
Date: |
Fri, 12 Nov 1999 17:59:59 -0500 |
Kevin Atkinson wrote:
>
> Kevin Atkinson wrote:
> >
> > Kevin Atkinson wrote:
> > >
> > > On Wed, 10 Nov 1999, Aaron Sherman wrote:
> > >
> > > > Am I doing something wrong? Is anyone using aspell under Solaris? I try
> > > > to
> > > > spell-check a file using the "-a" option (as I'm calling this from a
> > > > program), and it segfaults. I run gdb on it, and sure enough
> > > > metaphone.cc
> > > > creates a variable called "char wname[60]" and tries to put each word
> > > > into
> > > > it. If the word is larger than 60 characters, BOOM! I can't even see how
> > > > this is Solaris-specific.
> > > >
> > > > Granted, words longer than 60 characters are... rare, but not
> > > > everything in
> > > > a text file is going to be a valid word. I routinely see aspell crashing
> > > > because of this.
> > >
> > > You are absolutly right. I will look into it this weekend. It has never
> > > come up in my use of aspell.
> > >
> >
> > Here is a fix for that problem. I will have a new release out in a
> > couple of days. Apply the patch in the util/ directory.
> >
I discovered that my patch has a small bug in it. Here is a fixed one.
Sorry for the trouble.
--
Kevin Atkinson
address@hidden
http://metalab.unc.edu/kevina/
--- metaphone.cc~ Mon Dec 28 04:26:53 1998
+++ metaphone.cc Fri Nov 12 01:49:50 1999
@@ -418,8 +418,7 @@
int vowelAfter, vowelBefore, frontvAfter;
string metaph;
- char wname[60];
- char *ename=wname;
+ char *ename = new char[strlen(name)+1];
jj = 0;
for (ii=0; name[ii]; ++ii) {
@@ -431,7 +430,7 @@
metaph.reserve(jj);
ename[jj] = '\0';
- if (jj == 0) return metaph;
+ if (jj != 0) {
/* if ae, gn, kn, pn, wr then drop the first letter */
if ( (chrptr=strchr(excpPAIR,ename[0]) ) != 0 ) {
@@ -613,7 +612,9 @@
}
}
+ }
+ delete[] ename;
if (metaph.size() == 0) metaph = "-";
return metaph;
}