Author martin.panter
Recipients martin.panter, serhiy.storchaka, xiang.zhang
Date 2016-07-24.06:31:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I don’t accept that the bltinmodule.c code is similar to your patch. It gets a size_t from calling strlen() on a string that potentially comes from outside Python, so it is definitely valid to check for PY_SSIZE_T_MAX.

However I did find PyByteArray_Resize() (revision 1590c594550e), where this technique of calculating in size_t and then checking for overflow is used. And also in your favour is the definition in Include/pyport.h which currently guarantees size_t can store up to double PY_SSIZE_T_MAX:

/* Largest positive value of type Py_ssize_t. */
#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1))

So I am convinced there should be no real problem with your patch.
Date User Action Args
2016-07-24 06:31:22martin.pantersetrecipients: + martin.panter, serhiy.storchaka, xiang.zhang
2016-07-24 06:31:22martin.pantersetmessageid: <>
2016-07-24 06:31:22martin.panterlinkissue27581 messages
2016-07-24 06:31:22martin.pantercreate