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: fix double free with tqs in standard build
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: gvanrossum, nnorwitz, tim.peters
Priority: normal Keywords: patch

Created on 2006-04-10 03:26 by nnorwitz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
parser.diff nnorwitz, 2006-04-10 03:26 v1
Messages (5)
msg49975 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-04-10 03:26
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.
msg49976 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2006-04-10 04:02
Logged In: YES 
user_id=6380

Works for me.  Thanks for the quick fix!

I suppose Tim should review this.
msg49977 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2006-04-10 04:19
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 :-)
msg49978 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-04-10 04:40
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.
msg49979 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-04-10 06:42
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.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43183
2006-04-10 03:26:05nnorwitzcreate