Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Jul 25, 2008, 3:42 AM

Post #1 of 11 (514 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista

Antoine Pitrou <pitrou [at] free> added the comment:

Hirokazu, does replacing the following line (rather than changing the
type of the `ch` variable):
ch = *s;
with
ch = (unsigned char) *s;

fix the crash as well?

----------
keywords: +patch
nosy: +pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 4:10 AM

Post #2 of 11 (503 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Hirokazu Yamamoto <ocean-city [at] users> added the comment:

With this patch? Yes, it fixed crash.

Index: Objects/unicodeobject.c
===================================================================
--- Objects/unicodeobject.c (revision 65223)
+++ Objects/unicodeobject.c (working copy)
@@ -1523,7 +1523,7 @@
while (s < e) {
Py_UNICODE ch;
restart:
- ch = *s;
+ ch = (unsigned char)*s;

if (inShift) {
if ((ch == '-') || !B64CHAR(ch)) {


>>> '+\xc1'.decode("utf7")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "e:\python-dev\trunk\lib\encodings\utf_7.py", line 12, in decode
return codecs.utf_7_decode(input, errors, True)
UnicodeDecodeError: 'utf7' codec can't decode bytes in position 0-1:
unexpected

# But I don't know whether this behavior is right or not....

I confirmed test_unicode, test_codecs, test_codeccallbacks passed.

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 4:43 AM

Post #3 of 11 (511 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Amaury Forgeot d'Arc <amauryfa [at] gmail> added the comment:

VS8 and VS9 are immune to the crash, even if the exception message
differ between release and debug builds.

VC6 crashes, and the proposed patch fixes the problem there as well.

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 5:11 AM

Post #4 of 11 (511 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

Selon Hirokazu Yamamoto <report [at] bugs>:
>
> With this patch? Yes, it fixed crash.

Thanks!

> # But I don't know whether this behavior is right or not....

As the name implies, utf7 is a 7-bit coding of Unicode... bytes >= 0x80 must
raise an exception. The error message could be better though.

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 5:42 AM

Post #5 of 11 (511 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

This patch also has a test in it.

Added file: http://bugs.python.org/file10979/2242.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 10:53 AM

Post #6 of 11 (495 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

Should be fixed in r65227. Please reopen if there's still a problem.

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 10:59 AM

Post #7 of 11 (496 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

On second thought, perhaps it should also be backported to 2.5, so I'm
leaving the bug open.

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 11:06 AM

Post #8 of 11 (502 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Changes by Antoine Pitrou <pitrou [at] free>:


----------
resolution: -> accepted
versions: -Python 2.6, Python 3.0

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 12:04 PM

Post #9 of 11 (500 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

I've committed the fix for 2.5 in r65234, can somebody try it out with
the failing MSVC version?

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 2:19 PM

Post #10 of 11 (491 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Amaury Forgeot d'Arc <amauryfa [at] gmail> added the comment:

I confirm that r65234 for 2.5 corrects the crash.
(Windows XP, Visual Studio 6)

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 25, 2008, 2:21 PM

Post #11 of 11 (493 views)
Permalink
[issue2242] Decoding UTF-7 with "ignore warnings" crashes Python on Windows Vista [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

Thanks Amaury!

----------
resolution: accepted -> fixed
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue2242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.