[ python-Bugs-1185883 ] PyObject_Realloc bug in obmalloc.c
SourceForge.net
noreply at sourceforge.net
Tue Apr 19 16:39:03 CEST 2005
Bugs item #1185883, was opened at 2005-04-19 12:07
Message generated for change (Comment added) made by krisvale
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1185883&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Kristján Valur (krisvale)
Assigned to: Tim Peters (tim_one)
Summary: PyObject_Realloc bug in obmalloc.c
Initial Comment:
obmalloc.c:835
If the previous block was not handled by obmalloc, and
the realloc is for growing the block, this memcpy may
cross a page boundary and cause a segmentation
fault. This scenario can happen if a previous allocation
failed to successfully allocate from the obmalloc pools,
due to memory starvation or other reasons, but was
successfully allocated by the c runtime.
The solution is to query the actual size of the allocated
block, and copy only so much memory. Most modern
platforms provide size query functions complementing
the malloc()/free() calls. on Windows, this is the _msize
() function.
----------------------------------------------------------------------
>Comment By: Kristján Valur (krisvale)
Date: 2005-04-19 14:39
Message:
Logged In: YES
user_id=1262199
I can only say that I´ve been seeing this happeing with our
software. Admittedly it's because we are eating up all
memory due to other reasons, but we would like to deal with
that with a MemoryError rather than a crash.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2005-04-19 14:30
Message:
Logged In: YES
user_id=6656
Tim, what do you think?
This is a pretty unlikely scenario, it seems to me.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1185883&group_id=5470
More information about the Python-bugs-list
mailing list