This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2017-12-15.21:39:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513373952.98.0.213398074469.issue32342@psf.upfronthosting.co.za>
In-reply-to
Content
Coverity found an issue in the commit 2e3f5701858d1fc04caedefdd9a8ea43810270d2 (bpo-30416).

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)

** CID 1426161:  Integer handling issues  (DIVIDE_BY_ZERO)
/Python/ast_opt.c: 219 in safe_power()

________________________________________________________________________________________________________
*** CID 1426161:  Integer handling issues  (DIVIDE_BY_ZERO)
/Python/ast_opt.c: 219 in safe_power()
213         if (PyLong_Check(v) && PyLong_Check(w) && Py_SIZE(v) && Py_SIZE(w) > 0) {
214             size_t vbits = _PyLong_NumBits(v);
215             size_t wbits = PyLong_AsSize_t(w);
216             if (vbits == (size_t)-1 || wbits == (size_t)-1) {
217                 return NULL;
218             }
>>>     CID 1426161:  Integer handling issues  (DIVIDE_BY_ZERO)
>>>     In expression "128UL / wbits", division by expression "wbits" which may be zero has undefined behavior.
219             if (vbits > MAX_INT_SIZE / wbits) {
220                 return NULL;
221             }
222         }
223
224         return PyNumber_Power(v, w, Py_None);
History
Date User Action Args
2017-12-15 21:39:13vstinnersetrecipients: + vstinner, serhiy.storchaka
2017-12-15 21:39:12vstinnersetmessageid: <1513373952.98.0.213398074469.issue32342@psf.upfronthosting.co.za>
2017-12-15 21:39:12vstinnerlinkissue32342 messages
2017-12-15 21:39:12vstinnercreate