Author ztane
Recipients Jeffrey.Walton, alex, alexandre.vassalotti, christian.heimes, deadshort, dmalcolm, donmez, fweimer, gregory.p.smith, gvanrossum, jcea, jwilk, loewis, mark.dickinson, matejcik, nnorwitz, pitrou, python-dev, vstinner, ztane
Date 2016-07-10.13:05:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
One common case where signed integer overflow has been assumed has been the wraparound/overflow checks like in 

I propose that such commonly erroneous tasks such as overflow checks be implemented as common macros in CPython as getting them right is not quite easy (; it would also make the C code more self-documenting.

Thus instead of writing

     if (va.len > PY_SSIZE_T_MAX - vb.len) {
one would write something like
    if (PY_SSIZE_T_SUM_OVERFLOWS(va.len, vb.len)) {

and the mere fact that such a macro *wasn't* used there would signal about possible problems with the comparison.
Date User Action Args
2016-07-10 13:05:57ztanesetrecipients: + ztane, gvanrossum, loewis, nnorwitz, gregory.p.smith, jcea, mark.dickinson, pitrou, vstinner, christian.heimes, alexandre.vassalotti, donmez, matejcik, jwilk, alex, dmalcolm, python-dev, deadshort, fweimer, Jeffrey.Walton
2016-07-10 13:05:56ztanesetmessageid: <>
2016-07-10 13:05:56ztanelinkissue1621 messages
2016-07-10 13:05:56ztanecreate