Author martin.panter
Recipients Jeffrey.Walton, alex, alexandre.vassalotti, christian.heimes, deadshort, dmalcolm, donmez, fweimer, gregory.p.smith, gvanrossum, jcea, jwilk, loewis, mark.dickinson, martin.panter, matejcik, nnorwitz, pitrou, python-dev, serhiy.storchaka, vstinner, ztane
Date 2016-07-16.15:16:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468682160.67.0.551884707716.issue1621@psf.upfronthosting.co.za>
In-reply-to
Content
I tried the newer -fsanitize=undefined mode, and it is better than -ftrapv. It adds instrumentation that by default nicely reports the errors and continues running.

My problem with the large slice step is not restricted to Element Tree; it affects list objects too:

>>> "abcdef"[3::sys.maxsize]
Objects/unicodeobject.c:13794:55: runtime error: signed integer overflow: 3 + 9223372036854775807 cannot be represented in type 'long int'
'd'

Regarding Antti’s overflow macros, I noticed there is already a macro _PyTime_check_mul_overflow() in Python/pytime.c which does that kind of thing. Maybe it could help, though I am not sure. Has this sort of thing been done in other projects? We might need to be careful about the sign, e.g. clarify the macro is only for positive values, add an assertion, or handle both positive and negative.
History
Date User Action Args
2016-07-16 15:16:00martin.pantersetrecipients: + martin.panter, gvanrossum, loewis, nnorwitz, gregory.p.smith, jcea, mark.dickinson, pitrou, vstinner, christian.heimes, alexandre.vassalotti, donmez, matejcik, jwilk, alex, dmalcolm, python-dev, deadshort, serhiy.storchaka, ztane, fweimer, Jeffrey.Walton
2016-07-16 15:16:00martin.pantersetmessageid: <1468682160.67.0.551884707716.issue1621@psf.upfronthosting.co.za>
2016-07-16 15:16:00martin.panterlinkissue1621 messages
2016-07-16 15:16:00martin.pantercreate