-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hi,
We've noticed when using spamsum (along with pyspamsum), that when trying to compute spamsums for spamsum strings that are small (or converted to small ones) and identical, the computed result is 0 instead of 100:
printf("%d\n", spamsum_match("96:q66666666666666666666666666666666666666666666666666666666666666I:N",
"96:q66666666666666666666666666666666666666666666666666666666666666I:N'"));
0
Problem seems to lie in the has_common_substring, here: https://github.com/tridge/junkcode/blob/master/spamsum/spamsum.c#L260
Basically, trying to run has_common_substrings on identical strings that are less than 6 chars results to returning zero, even though it should return one.
I know that we probably don't want to return substrings that are less than 7 characters, but maybe we could hook a strstr(s1, s2); strstr(s2, s1) somewhere, to at least cover the case where the strings are identical, but small?
I can submit a PR if you wish :)