I think this patch will fix PR#514 in the bug database. It's Geoff's
first patch, with a minor correction, plus an added test in the vscode
macro, which is where the problem seemed to be happening. The author
of the metaphone code likely assumed that isalpha() meant [A-Za-z],
and forgot about upper half characters. This won't do anything to map
accented vowels to their unaccented counterparts, but it should hopefully
put an end to the segmentation faults.
--- htdig-3.1.2.bak/htfuzzy/Fuzzy.cc Wed Apr 21 21:47:58 1999
+++ htdig-3.1.2/htfuzzy/Fuzzy.cc Fri Jul 30 16:37:42 1999
@@ -55,6 +55,8 @@ Fuzzy::getWords(char *word, List &words)
{
if (!index)
return;
+ if (!word || !*word)
+ return;
//
// Convert the word to a fuzzy key
--- htdig-3.1.2.bak/htfuzzy/Metaphone.cc Wed Apr 21 21:47:58 1999
+++ htdig-3.1.2/htfuzzy/Metaphone.cc Tue Aug 3 14:50:06 1999
@@ -51,7 +51,7 @@ static char vsvfn[26] = {
/* N O P Q R S T U V W X Y Z */
/* Macros to access character coding array */
-#define vscode(x) (vsvfn[(x) - 'A'])
+#define vscode(x) ((x) >= 'A' && (x) <= 'Z' ? vsvfn[(x) - 'A'] : 0)
#define vowel(x) ((x) != '\0' && vscode(x) & 1) /* AEIOU */
#define same(x) ((x) != '\0' && vscode(x) & 2) /* FJLMNR */
#define varson(x) ((x) != '\0' && vscode(x) & 4) /* CGPST */
@@ -63,6 +63,9 @@ static char vsvfn[26] = {
void
Metaphone::generateKey(char *word, String &key)
{
+ if (!word || !*word)
+ return;
+
char *n;
String ntrans;
--
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
------------------------------------
To unsubscribe from the htdig mailing list, send a message to
[EMAIL PROTECTED] containing the single word unsubscribe in
the SUBJECT of the message.