Gilles,

Sorry that C++ isn't my strongest language, otherwise I'd have attempted the patch.

Here's a transcript of the run and a backtrace:

neilk@acpsun01$ htfuzzy -c acpjc.conf -v -v synonyms
htfuzzy: Selected algorithm: synonyms
htfuzzy/synonyms: 0 abdomen
htfuzzy/synonyms: 10 acei
htfuzzy/synonyms: 20 adhd
htfuzzy/synonyms: 30 juvenile
htfuzzy/synonyms: 40 longevity
htfuzzy/synonyms: 50 allergen
htfuzzy/synonyms: 60 amebicides
htfuzzy/synonyms: 70 amputation
htfuzzy/synonyms: 80 anaemia
htfuzzy/synonyms: 90 angioplasty
htfuzzy/synonyms: 100 anoxaemia
Segmentation Fault(coredump)
neilk@acpsun01$ ls
acpjc.conf      acpjcadv.conf   core
neilk@acpsun01$ adb `which htfuzzy` core
core file = core -- program ``htfuzzy'' on platform SUNW,Ultra-5_10
SIGSEGV: Segmentation Fault
$C
blalign() + a04
        [savfp=0xffbef430,savpc=0x2f834]
blalign(b5080,acf00,17,ffff2ec0,58,a8030) + 54
        [savfp=0xffbef490,savpc=0x2f834]
copy_data_from__6StringPcii(ffbef5d0,acf18,ffffffff,0,81010100,ff00) + 10
        [savfp=0xffbef500,savpc=0x2ee30]
append__6StringPci(ffbef5d0,acf18,ffffffff,0,583ac,ff223bac) + 48
        [savfp=0xffbef570,savpc=0x2cb4c]
Put__8DatabasePcT1i(aedf8,ffbef5d0,acf18,ffffffff,b8da4,3e0) + 34
        [savfp=0xffbef600,savpc=0x2a3a8]
createDB__7SynonymR13Configuration(0,ffbef678,ffbef698,a6de8,84c00,84c00) + 208
        [savfp=0xffbefa90,savpc=0x2ada8]
main(a7c70,ffbefbd4,a3c00,ffbefb50,0,0) + 64c
        [savfp=0x0,savpc=0x2700c]



Neil Kohl
Manager, ACP-ASIM Online              
American College of Physicians - American Society of Internal Medicine
[EMAIL PROTECTED]              215.351.2638, 800.523.1546 x2638


>>> Gilles Detillieux <[EMAIL PROTECTED]> 11/20/01 06:01PM >>>
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

_______________________________________________
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