[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-12 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-12 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved ___ Python tracker ___ ___ Python-bugs-list mai

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset 130d97217e36 by Serhiy Storchaka in branch '2.7': Issue #27473: Fixed possible integer overflow in str, unicode and bytearray https://hg.python.org/cpython/rev/130d97217e36 -- ___ Python tracker

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Left a comment. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch for 2.7. It fixes also concatenation and repetition of str and unicode. -- stage: commit review -> patch review Added file: http://bugs.python.org/file43678/concat_and_repeat_overflow_check-2.7.patch _

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset dac248056b20 by Serhiy Storchaka in branch '3.5': Issue #27473: Fixed possible integer overflow in bytes and bytearray https://hg.python.org/cpython/rev/dac248056b20 New changeset de8f0e9196d8 by Serhiy Storchaka in branch 'default': Issue #27473: F

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. -- assignee: -> serhiy.storchaka stage: needs patch -> commit review ___ Python tracker ___ ___

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Sorry. v3 now includes iconcat. -- Added file: http://bugs.python.org/file43676/bytes_concat_overflow_check_v3.patch ___ Python tracker ___ __

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: And bytearray_iconcat() please. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Of course. I forgot to check bytearray. :( The new patch now also includes bytearray. -- Added file: http://bugs.python.org/file43675/bytes_concat_overflow_check_v2.patch ___ Python tracker

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Xiang Zhang, could you please write a patch for bytearray too? -- stage: commit review -> needs patch ___ Python tracker ___ _

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Yes, the current code is valid with -fwrapv. But I am not sure if every compiler supports this feature. So maybe we can't totally rely on it. And in issue1621, some efforts seem to have worked to factor these out. -- _

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Antti Haapala
Antti Haapala added the comment: The previous code was perfectly fine with `-fwrapv` since it makes signed overflow behaviour defined. And afaik BDFLs stance is that signed integer overflow should be defined to wrap anyhow. In my opinion the `-fwrapv` itself makes one proliferate all the

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Martin Panter
Martin Panter added the comment: I changed the versions without checking first. Long story short: Objects/stringobject.c (Python 2 equivalent of Objects/bytesobject.c) is already fixed, but in all versions, Objects/bytearrayobject.c is apparently unfixed. Python 2 was fixed as part of r65335.

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Martin Panter
Martin Panter added the comment: The patch looks correct to me. Issue 1621 is open about the general problem of overflows. -- nosy: +martin.panter stage: needs patch -> commit review versions: +Python 2.7, Python 3.5 ___ Python tracker

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-09 Thread Xiang Zhang
Xiang Zhang added the comment: Attach a patch to fix this. -- keywords: +patch Added file: http://bugs.python.org/file43671/bytes_concat_overflow_check.patch ___ Python tracker _

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This should be fixed. -- components: +Interpreter Core stage: -> needs patch ___ Python tracker ___ _

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-09 Thread Xiang Zhang
New submission from Xiang Zhang: bytes_concat uses following code to check overflow: size = va.len + vb.len; if (size < 0): { PyErr_NoMemory(); goto done; } This is wrong since signed ints overflow is undefined bahaviour. But one point is that Python's Makefile defines -fwrapv with gcc

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-09 Thread Xiang Zhang
Changes by Xiang Zhang : -- type: -> behavior versions: +Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr