Subject: | Division bt zero bug in Overlaps.pm getSimilarity() |
In some cases, $score may be zero and is used to calculate the
denominator in a later division. This results in a seg fault due to
division by zero.
The attached patch will short circuit this case and return zero before
the division occurs.
Subject: | Overlaps.pm.patch |
*** Overlaps.pm.orig 2007-10-10 10:56:09.000000000 -0600
--- Overlaps.pm 2007-10-10 11:04:40.000000000 -0600
***************
*** 139,144 ****
--- 139,148 ----
$score += scalar @words * $overlaps->{$key};
}
+ if ( $score == 0 ) {
+ return $score;
+ }
+
if ($self->normalize) {
if ($self->verbose) {
print "wc 1: $wc1\n";