[exim-dev] [Bug 2987] New: $spam_score_int calculation for n…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: admin
Ημερομηνία:  
Προς: exim-dev
Αντικείμενο: [exim-dev] [Bug 2987] New: $spam_score_int calculation for negative values is off-by-one
https://bugs.exim.org/show_bug.cgi?id=2987

            Bug ID: 2987
           Summary: $spam_score_int calculation for negative values is
                    off-by-one
           Product: Exim
           Version: 4.97
          Hardware: All
                OS: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Content Scanning
          Assignee: tom@???
          Reporter: bugzilla847@???
                CC: exim-dev@???


The internal calculation of spam_score_int in spam.c seems to be off-by-one if
negative spamd_score values are encountered:

/* create "int" spam score */
j = (int)((spamd_score + 0.001)*10);
(void)string_format(spam_score_int_buffer, sizeof(spam_score_int_buffer),
        "%d", j);
spam_score_int = spam_score_int_buffer;


The above yields correct results for positive spam scores (0.1 => 1, 4.8 =>
48), but will be off for negative values (-0.1 => 0, -4.8 => -47).

I guess the correct way of fixing this would be to differentiate between
positive and negative spamd_score values (adding 0.001 to positive and
subtracting 0.001 from negative values before casting to int).

--
You are receiving this mail because:
You are on the CC list for the bug.