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: crash using unicode latin1 single char
Type: Stage:
Components: Unicode Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lemburg Nosy List: lemburg, nnorwitz
Priority: high Keywords:

Created on 2002-10-21 02:52 by nnorwitz, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
killuni.py nnorwitz, 2002-10-21 02:52 test case which crashes interpretter
Messages (3)
msg12884 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-10-21 02:52
The following code will crash python (also attached as
file):

try:
    for c in u'\xe2':
        c in 'g\xe2teau'
except UnicodeError:
    pass

The problem appears to be a double free.  Ref count
goes negative in a debug build.
The problem is with the unicode_latin1 module variable.
 If I comment out the line 

  unicode_latin1[*u] = unicode; 

in unicodeobject.c (~316 in CVS).  Everything is fine.
 That obviously is not correct.  I added another INCREF:

  Py_INCREF(unicode_latin1[*u]);

That also fixed the crash.  I'm not sure if the INCREF
is the correct solution.

This bug appeared on usenet: 
http://mail.python.org/pipermail/python-list/2002-October/127682.html
msg12885 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-10-21 03:15
Logged In: YES 
user_id=33168

A little more testing and neither of the fixes above
corrects this one liner which crashes the interpreter:
  u'\xe2' in '\xe2'

My latest suspicion is in PyUnicodeUCS2_DecodeASCII(), but I
don't have enough time to debug this properly.
msg12886 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2002-10-23 08:50
Logged In: YES 
user_id=38388

It's a bug in PyUnicode_Contains(). I'll check in a fix.
History
Date User Action Args
2022-04-10 16:05:46adminsetgithub: 37349
2002-10-21 02:52:29nnorwitzcreate