[Python-Dev] Invalid memory read in PyObject_Free

Michael Hudson mwh@python.net
Fri, 04 Jul 2003 17:51:15 +0100


Guido van Rossum <guido@python.org> writes:

>> >> In obmalloc.c there is some code that does not strictly conform to
>> >> ANSI C.
>> >
>> > True.  If we wanted to strictly conform to ANSI C, we couldn't do many
>> > things we do.
>> 
>> Sure, but this one is a little bit more eccentric than the others...
>
> Hm...  Do you have a suggestion for making the code more ANSI
> conformant?  Surely checking whether an address is within a certain
> range shouldn't require accessing any out-of-bounds memory?  Or am I
> mistaken about how the offending piece of code works?

I don't think it's avoidable, or at least Tim doesn't:

http://mail.python.org/pipermail/python-dev/2002-July/027114.html

>> Is this a real problem with pymalloc?
>> 
>> #ifndef PYMALLOC
>> #define PyObject_Alloc malloc
>> #else
>> ...
>> #endif
>> 
>> isn't likely to bitrot that fast.  But, whatever, it's no big deal to
>> me.
>
> If that's all, it probably isn't a big deal. :-)
>
> [Doing anything to avoid having to look at the actual code...]

Well, I haven't gone that far either :-)

Cheers,
M.

-- 
  After a heavy night I travelled on, my face toward home - the comma
  being by no means guaranteed.           -- paraphrased from cam.misc