[Patches] [ python-Patches-1467512 ] fix double free with tqs in standard build
SourceForge.net
noreply at sourceforge.net
Mon Apr 10 08:42:49 CEST 2006
Patches item #1467512, was opened at 2006-04-09 20:26
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1467512&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: Core (C code)
Group: Python 2.5
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: Neal Norwitz (nnorwitz)
Summary: fix double free with tqs in standard build
Initial Comment:
Fix for
http://mail.python.org/pipermail/python-dev/2006-April/063572.html
Convert all PyMem_* to PyObject_* that way we can't
have an inconsistent use of PyMem_ and PyObject_ APIs
in the Parser. This could even be a perf win if more
of the allocations are smaller than 256 bytes. I don't
know if that's more common though.
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-04-09 23:42
Message:
Logged In: YES
user_id=33168
The only inconsistency I could find was at line 818 of
tokenizer.c:
tok->buf = new;
new is PyMem_*, but tok->buf is PyObject_* everywhere except
this assignment.
I didn't see an easy fix other than reallocating and copying
instead of the assignment.
I undid a few of the changes in the patch.
Committed revision 45225.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2006-04-09 21:40
Message:
Logged In: YES
user_id=33168
Heh, I'm going the opposite direction. I'm going to
selectively move some of the known big calls back to
PyMem_*. I also notice that there are a lot of allocs
without this patch are larger than 256 bytes. I'm going to
research those too. Thanks for the review.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2006-04-09 21:19
Message:
Logged In: YES
user_id=31435
I noted some cautions on python-dev, but marked Accepted.
In general I'm nervous about more-or-less mindless s/x/y/g
patches, but Guido's bug is proof that my time-consuming
selective approach may well not be the best approach to this
mess :-)
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2006-04-09 21:02
Message:
Logged In: YES
user_id=6380
Works for me. Thanks for the quick fix!
I suppose Tim should review this.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1467512&group_id=5470
More information about the Patches
mailing list