According to Neil Kohl:
> I'm running htdig 3.1.6 on Solaris 7/sparc. 
> 
> I was trying to build a custom synonym database with htfuzzy and it
> kept segfaulting and dumping core. I could successfully rebuild the
> synonyms.db from the distribution so I figured there was something
> wrong with my synonyms file.
> 
> Sure enough, there was one term that didn't have any synonyms - it
> was a single word on a line by itself.
> 
> Just putting this out to the list in case someone runs into similar
> problems in the future, and as a suggestion for a mod to htfuzzy:
> graceful handling of bad lines in the synonyms file.

[Suspending lurk mode]

Thanks for the report!  Here's the fix, which will be in this Sunday's
snapshot.  You didn't include a stack backtrace, so I can only speculate
that the segfault occurred in Database::Put(), which seems like the
only plausible explanation.  Actually, looking into it a bit further,
it seems there's a problem in String::append(char *, int) as well,
in that it doesn't check for negative lengths.  Database::Put() calls
String::append(), so that may be the source of the problem.  I'd still
appreciate a stack backtrace to confirm where the problem occurred.
I'd like to close as many holes as I can before 3.1.6 is released.


Tue Nov 20 16:37:26 2001  Gilles Detillieux  <[EMAIL PROTECTED]>

        * htfuzzy/Synonym.cc (createDB): Check for lines with less than
        2 words, to avoid segfault caused by calling DB::Put() with negative
        length for data field.

Index: htfuzzy/Synonym.cc
===================================================================
RCS file: /cvsroot/htdig/htdig/htfuzzy/Synonym.cc,v
retrieving revision 1.3.2.2
diff -u -p -r1.3.2.2 Synonym.cc
--- htfuzzy/Synonym.cc  1999/03/31 21:25:12     1.3.2.2
+++ htfuzzy/Synonym.cc  2001/11/20 22:36:40
@@ -74,6 +74,16 @@ Synonym::createDB(Configuration &config)
     while (fgets(input, sizeof(input), fl))
     {
        StringList      sl(input, " \t\r\n");
+       if (sl.Count() < 2)
+       {
+           if (debug)
+           {
+               cout << "htfuzzy/synonyms: Rejected line with less than 2 words: "
+                    << input << endl;
+               cout.flush();
+           }
+           continue;
+       }
        for (int i = 0; i < sl.Count(); i++)
        {
            data = 0;

[Resuming lurk mode]

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a 
subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to