This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Broken error handling in codecs.escape_decode()
Type: crash Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: doerwalter, lemburg, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-01-15 21:42 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
escape_decode_error_handling.patch serhiy.storchaka, 2013-01-16 12:04 Patch for 3.x review
escape_decode_error_handling-2.7.patch serhiy.storchaka, 2013-01-16 12:04 Patch for 2.7 review
Messages (4)
msg180056 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-15 21:42
>>> import codecs
>>> codecs.escape_decode(r'\x1\x2\x3\x4\x5\x6\x7\x8\x9', 'replace')
(b'?\\x1?\\x2?\\x3?\\x4?\\x5?\\x6?\\x', 27)
>>> codecs.escape_decode(r'\x1\x2\x3\x4\x5\x6\x7\x8\x9' * 1000, 'replace')
Segmentation fault
msg180078 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-16 10:47
See also issue16979.
msg180082 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-16 12:04
Here is a patch which fixes error handling in codecs.escape_decode().

>>> codecs.escape_decode(r'[\x1]\x2', 'replace')
(b'[?]?', 8)

New tests for escape_decode() added.
msg180627 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-01-25 21:43
New changeset 5970c90dd8d1 by Serhiy Storchaka in branch '2.7':
Issue #16975: Fix error handling bug in the escape-decode decoder.
http://hg.python.org/cpython/rev/5970c90dd8d1

New changeset 22594c5060eb by Serhiy Storchaka in branch '3.2':
Issue #16975: Fix error handling bug in the escape-decode bytes decoder.
http://hg.python.org/cpython/rev/22594c5060eb

New changeset 580d536cc910 by Serhiy Storchaka in branch '3.3':
Issue #16975: Fix error handling bug in the escape-decode bytes decoder.
http://hg.python.org/cpython/rev/580d536cc910

New changeset 513b728695fc by Serhiy Storchaka in branch 'default':
Issue #16975: Fix error handling bug in the escape-decode bytes decoder.
http://hg.python.org/cpython/rev/513b728695fc
History
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61179
2013-01-29 09:53:49serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-01-25 21:43:55python-devsetnosy: + python-dev
messages: + msg180627
2013-01-16 12:04:40serhiy.storchakasetfiles: + escape_decode_error_handling-2.7.patch
2013-01-16 12:04:04serhiy.storchakasetfiles: + escape_decode_error_handling.patch

nosy: + lemburg, doerwalter
messages: + msg180082

keywords: + patch
stage: needs patch -> patch review
2013-01-16 10:47:38serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg180078
stage: needs patch
2013-01-15 21:42:51serhiy.storchakacreate