Author christian.heimes
Recipients christian.heimes, serhiy.storchaka, terry.reedy
Date 2014-01-26.23:45:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390779959.83.0.901638495575.issue20394@psf.upfronthosting.co.za>
In-reply-to
Content
Coverity is concerned about the value of `q` when `len < 0`. The expression

   Py_ssize_t q = len > 0 ? 1 + (len - 1) / inrate : 0;

returns a positive, non-null value for len > 0. Another check ensures that len != 0 a couple of lines earlier. In theory it is possible that len < 0. After all it's a signed integer type.

Coverity tries very hard to guess the intention of code. Because there is a check for len > 0, Coverity thinks that the code has to handle len < 0. IMO a good fix should check len >= 0 very early and replace that line with

   Py_ssize_t q = 1 + (len - 1) / inrate;
History
Date User Action Args
2014-01-26 23:45:59christian.heimessetrecipients: + christian.heimes, terry.reedy, serhiy.storchaka
2014-01-26 23:45:59christian.heimessetmessageid: <1390779959.83.0.901638495575.issue20394@psf.upfronthosting.co.za>
2014-01-26 23:45:59christian.heimeslinkissue20394 messages
2014-01-26 23:45:59christian.heimescreate