[issue18427] str.replace causes segfault for long strings

2013-07-15 Thread Ronald Oussoren
Ronald Oussoren added the comment: Serhiy: you're right. I've moved the message to the correct section. -- ___ Python tracker ___ ___

[issue18427] str.replace causes segfault for long strings

2013-07-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 06d9f106c57e by Ronald Oussoren in branch '2.7': Move entry from #18427 to the right section in the NEWS file http://hg.python.org/cpython/rev/06d9f106c57e -- ___ Python tracker

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think NEWS entry for this issue should be in the "Core and Builtins" section. -- ___ Python tracker ___

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Ronald Oussoren
Changes by Ronald Oussoren : -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2921f6c2009e by Ronald Oussoren in branch '2.7': Issue #18427: str.replace could crash the interpreter with huge strings. http://hg.python.org/cpython/rev/2921f6c2009e -- nosy: +python-dev ___ Python trac

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Ronald Oussoren
Ronald Oussoren added the comment: Great. I'll apply after running the full testsuite, and after rebooting my machine as it doesn't really like using that much additional memory and pushed some applications to disk :-( -- ___ Python tracker

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Christian Heimes
Christian Heimes added the comment: LGTM! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Ronald Oussoren
Ronald Oussoren added the comment: The attached patch should fix both issues (but doesn't contain a test, not sure if its worthwhile to add a testcase that uses more than 4 GByte of memory) FWIW: the corresponding code in Objects/bytesobject.c in the 3.3 and default branches is already correct

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Ronald Oussoren
Ronald Oussoren added the comment: There is also this one in string_print: fwrite(data, 1, (int)size, fp); "size" is a Py_ssize_t variable with the length of the string, and is casted to int which looses information. The exected argument to fwrite is size_t... These two appear to be t

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Ronald Oussoren
Ronald Oussoren added the comment: I agree: target_len should have type Py_ssize_t. It's probably worthwhile to check other functions as well. -- nosy: +ronaldoussoren ___ Python tracker __

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Christian Heimes
Christian Heimes added the comment: PS: The test case no longer segfaults with Py_ssize_t. -- ___ Python tracker ___ ___ Python-bugs-l

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Christian Heimes
Christian Heimes added the comment: #0 memchr () at ../sysdeps/x86_64/memchr.S:155 #1 0x00467ca4 in countchar (maxcount=, c=10 '\n', target_len=-1152922353, target=0x7fff3b196034 'A' ...) at Objects/stringobject.c:2341 #2 replace_delete_single_character (maxcount=, from_c=10 '\n',

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue18427] str.replace causes segfault for long strings

2013-07-11 Thread Tobias Marschall
New submission from Tobias Marschall: Running the following two lines of code causes a segfault: s = 'A' * 3142044943 t = s.replace('\n','') My setup: Python 2.7.5 (default, Jul 11 2013, 11:17:50) [GCC 4.6.3] on linux2 Linux 3.2.0-45-generic #70-Ubuntu SMP Wed May 29 20:12:06 UTC 2013 x86_64