Author petrum@gmail.com
Recipients petrum@gmail.com
Date 2018-07-26.04:55:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532580928.78.0.56676864532.issue34229@psf.upfronthosting.co.za>
In-reply-to
Content
While experimenting with a CodeSonar plugin we develop, we noticed a potential bug in file "cpython/Objects/sliceobject.c" line 116 function PySlice_GetIndices.

if (r->start == Py_None) {
    *start = *step < 0 ? length-1 : 0;
} else {
    if (!PyInt_Check(r->start) && !PyLong_Check(r->step)) return -1;//HERE
    *start = PyInt_AsSsize_t(r->start);
    if (*start < 0) *start += length;
}

Shouldn't start field of r be used in the second check (instead of step)?

In a related potential issue, in line 123, shouldn't r->stop be checked in the second verification?

Thanks,
Petru Florin Mihancea
History
Date User Action Args
2018-07-26 04:55:28petrum@gmail.comsetrecipients: + petrum@gmail.com
2018-07-26 04:55:28petrum@gmail.comsetmessageid: <1532580928.78.0.56676864532.issue34229@psf.upfronthosting.co.za>
2018-07-26 04:55:28petrum@gmail.comlinkissue34229 messages
2018-07-26 04:55:28petrum@gmail.comcreate