[Patches] [ python-Patches-1297028 ] cjkcodecs does not initialize type pointer

SourceForge.net noreply at sourceforge.net
Fri Sep 23 05:29:11 CEST 2005


Patches item #1297028, was opened at 2005-09-20 16:25
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1297028&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.4
Status: Closed
Resolution: Accepted
Priority: 9
Submitted By: Eric Huss (ehuss)
Assigned to: Anthony Baxter (anthonybaxter)
Summary: cjkcodecs does not initialize type pointer

Initial Comment:
The cjkcodecs code does not initialize the ob_type 
pointer for the 3 type objects it defines.

The following code will illustrate a segmentation fault:

>>> import _codecs_cn
>>> c = _codecs_cn.getcodec('gb2312')
>>> type(c)
Segmentation fault (core dumped)

I have attached a patch which should solve the problem.


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2005-09-22 20:29

Message:
Logged In: YES 
user_id=33168

Eric, I have a question about your patch.  Is there any
reason you didn't change PyObject_HEAD_INIT(NULL) to
PyObject_HEAD_INIT(&PyType_Type) rather than do the
assignment in init?

Thanks.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2005-09-22 20:25

Message:
Logged In: YES 
user_id=33168

I figured Anthony is busy enough. I checked this in since he
said he would.  My bad if you didn't want it in 2.4.2.

Checked in as:
 * Misc/NEWS 1.1193.2.107
 * Modules/cjkcodecs/multibytecodec.c 1.3.2.1



----------------------------------------------------------------------

Comment By: Anthony Baxter (anthonybaxter)
Date: 2005-09-20 23:57

Message:
Logged In: YES 
user_id=29957

Yes, branch is still frozen. I'll check this in once 2.4.2c1
is out (before 2.4.2 final). I can't get a test case to fail
(rather than just segfault). 




----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2005-09-20 23:46

Message:
Logged In: YES 
user_id=33168

Thanks!

Checked in as:
 * Misc/NEWS 1.1374
 * Modules/cjkcodecs/multibytecodec.c 1.4

This needs to be backported.  Anthony is the branch still
frozen?  Feel free to backport this.

I tried to create a test, but it didn't crash.  If someone
can write a test that crashes when running under
regrtest.py, that would be great.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1297028&group_id=5470


More information about the Patches mailing list