[issue27581] Fix overflow check in PySequence_Tuple

2016-07-25 Thread Martin Panter
Changes by Martin Panter : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue27581] Fix overflow check in PySequence_Tuple

2016-07-24 Thread Roundup Robot
Roundup Robot added the comment: New changeset ad3762227655 by Martin Panter in branch '3.5': Issue #27581: Don’t rely on overflow wrapping in PySequence_Tuple() https://hg.python.org/cpython/rev/ad3762227655 New changeset 8f84942a0e40 by Martin Panter in branch 'default': Issue #27581: Merge

[issue27581] Fix overflow check in PySequence_Tuple

2016-07-24 Thread Martin Panter
Martin Panter added the comment: 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()

[issue27581] Fix overflow check in PySequence_Tuple

2016-07-23 Thread Xiang Zhang
Xiang Zhang added the comment: I'd prefer the size_t method. The others seems to make the logic not clear. I've seen some codes using size_t to do overflow checking, such as https://hg.python.org/cpython/file/tip/Python/bltinmodule.c#l1954. There are more if you use a simple grep. So I think

[issue27581] Fix overflow check in PySequence_Tuple

2016-07-23 Thread Martin Panter
Martin Panter added the comment: Hmm maybe this patch is okay. We are assuming size_t will fit more than PY_SSIZE_T_MAX. The alternatives I can think of would be equally ugly: /* Risks loss of precision, e.g. 64 bit integer from floating point */ if (n < (Py_ssize_t)(PY_SSIZE_T_MAX / 1.25) -

[issue27581] Fix overflow check in PySequence_Tuple

2016-07-20 Thread Xiang Zhang
New submission from Xiang Zhang: Overflow check in PySequence_Tuple relies on undefined behaviour, fix it. -- components: Interpreter Core files: overflow_check_in_PySequence_Tuple.patch keywords: patch messages: 270909 nosy: martin.panter, serhiy.storchaka, xiang.zhang priority: normal