Author ZackerySpytz
Recipients ZackerySpytz, martin.panter
Date 2019-05-17.05:48:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558072124.41.0.0531416904304.issue36946@roundup.psfhosted.org>
In-reply-to
Content
Python 3.8.0a4+ (heads/master:870b035bc6, May 16 2019, 20:53:02) 
[GCC 9.0.1 20190402 (experimental) [trunk revision 270074]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> 'hi'[1::sys.maxsize]
Objects/unicodeobject.c:14038:55: runtime error: signed integer overflow: 1 + 9223372036854775807 cannot be represented in type 'long int'
'i'
>>>

This is because unicode_subscript() performs an extra addition (cur += step) at the end of the for loop (which can overflow). The result of that final addition is not actually used.

A patch to fix this issue was posted on #1621, but it seems that the patch has been abandoned. The bug is also described in detail in that issue. I have tweaked the patch and will open a PR.
History
Date User Action Args
2019-05-17 05:48:44ZackerySpytzsetrecipients: + ZackerySpytz, martin.panter
2019-05-17 05:48:44ZackerySpytzsetmessageid: <1558072124.41.0.0531416904304.issue36946@roundup.psfhosted.org>
2019-05-17 05:48:44ZackerySpytzlinkissue36946 messages
2019-05-17 05:48:44ZackerySpytzcreate