Message271133
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:22 | martin.panter | set | recipients:
+ martin.panter, serhiy.storchaka, xiang.zhang |
2016-07-24 06:31:22 | martin.panter | set | messageid: <1469341882.56.0.597221456378.issue27581@psf.upfronthosting.co.za> |
2016-07-24 06:31:22 | martin.panter | link | issue27581 messages |
2016-07-24 06:31:22 | martin.panter | create | |
|