[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3ef7d1af5195 by Serhiy Storchaka in branch '2.7': Issue #25678: Copy buffer objects to null-terminated strings. https://hg.python.org/cpython/rev/3ef7d1af5195 -- nosy: +python-dev ___ Python tracker

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Committed after fixing some details. Thank you Eryk Sun. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker __

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka stage: needs patch -> patch review ___ Python tracker ___ ___ Python-b

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
Eryk Sun added the comment: > I think the tests should be using buffer(..., a, b) instead. Thanks, you're right. :) -- Added file: http://bugs.python.org/file41102/issue25678_3.patch ___ Python tracker ___

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Sven Berkvens-Matthijsse
Sven Berkvens-Matthijsse added the comment: (Please excuse my horrible spelling in my last message, I'm apparently more tired than I care to admit) -- ___ Python tracker ___ ___

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Sven Berkvens-Matthijsse
Sven Berkvens-Matthijsse added the comment: Eryk, could the tests in the path file that you posted regarding int() and float() be incorrect in the sense that buffer(...)[a:b] returns a str() and not another buffer() (and will thus always be NUL terminated and not exhibit the problem, whether o

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
Changes by Eryk Sun : Added file: http://bugs.python.org/file41101/issue25678_2.patch ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you backport full patch, with tests? And compile() is affected too: >>> compile(buffer("123\0test", 1, 2), '', 'exec') at 0xb70c5800, file "", line 1> >>> compile(buffer("123test", 1, 2), '', 'exec') Traceback (most recent call last): File "", line 1,

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
Eryk Sun added the comment: I just made a quick modification to check that it works. I'm sure you could do the same. But here it is anyway. -- keywords: +patch Added file: http://bugs.python.org/file41095/issue25678.patch ___ Python tracker

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Do you forgot to add a patch? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
Eryk Sun added the comment: > Now we have an example, and can backport that patch. More seriously it's possible to get a buffer over-read using NumPy: >>> import numpy >>> int(buffer(numpy.array('123', dtype='c'))) Traceback (most recent call last): File "", line 1, in V

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is similar to issue24802. The patch for issue24802 was not backported to 2.7 because affected functions don't accept memoryview in Python 2. Now we have an example, and can backport that patch. -- nosy: +martin.panter, serhiy.storchaka stage: -

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Sven Berkvens-Matthijsse
New submission from Sven Berkvens-Matthijsse: Calling int() or long() on a buffer() object in Python 2.7 does not do the right thing. The following code snippet: buf = buffer("123test", 1, 2) print buf print int(buf) does not do what I would expect (that it print "23" twice). Instead, it print