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 Windson Yang
Recipients Windson Yang
Date 2018-10-06.05:31:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538803916.84.0.545547206417.issue34912@psf.upfronthosting.co.za>
In-reply-to
Content
In [resize_buffer](https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Modules/_io/stringio.c#L85)

    /* For simplicity, stay in the range of the signed type. Anyway, Python
       doesn't allow strings to be longer than this. */
    if (size > PY_SSIZE_T_MAX)
        goto overflow;
        ...

IMO, we should check the overflow with

    if (size > PY_SSIZE_T_MAX/sizeof(Py_UCS4))

Or we can just delete this code because we will check later at [alloc_check](https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Modules/_io/stringio.c#L107)

BTW, I found we only use PY_SIZE_MAX here in CPython, I wonder why we do not use PY_SSIZE_T_MAX instead?
History
Date User Action Args
2018-10-06 05:31:56Windson Yangsetrecipients: + Windson Yang
2018-10-06 05:31:56Windson Yangsetmessageid: <1538803916.84.0.545547206417.issue34912@psf.upfronthosting.co.za>
2018-10-06 05:31:56Windson Yanglinkissue34912 messages
2018-10-06 05:31:56Windson Yangcreate