Date: Fri, 23 Apr 2004 12:02:22 +0200 From: Alex Kiesel To: htdig-general@lists.sourceforge.net Subject: Re: [htdig] 'htfuzzy soundex' segfaulting On Thu, 2004-04-22 at 19:02, Alex Kiesel wrote: > htfuzzy soundex then segfaults. I ran it with strace: > $ strace htfuzzy -v soundex -c /etc/htdig/htdig.conf I've produced a more informational backtrace by compiling it from source and trying again. The problem occurs when one has activated the option allow_numbers: true and tried to run 'htfuzzy soundex' on the database files. As numbers from a string are being skipped in Soundex::generateKey(), a segfault occurs as the char *word is being increased by while (!isalpha(*word)) word++; if the given word contains numbers only (or: contains only nonalpha chars, to be precise). The attached diff[1] fixes this problem for me, it's a diff against htdig 3.1.6, file htdig-3.1.6/htfuzzy/Soundex.cc Regards, -Alex [1] Also at: http://document-root.de/patches/htdig-htfuzzy-segfault-20040423.diff --- Soundex.cc.orig Fri Apr 23 11:42:11 2004 +++ Soundex.cc Fri Apr 23 11:45:53 2004 @@ -46,10 +46,11 @@ return; } - while (!isalpha(*word)) + while (!isalpha(*word) && *word != '\0') { word++; + } - if (word) + if (*word) { key << *word++; }