This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Malloc routines have overflow problems


Jeff,

On Tue, Aug 06, 2002 at 02:58:08PM -0400, J. Johnston wrote:
> Jason Tishler wrote:
> > My patch is a "superset" of Chris's and solves the overflow problem
> > in both malloc() and realloc().  Is this an acceptable solution?  If
> > so, then I will gladly supply a ChangeLog entry.  If not, what would
> > be?
> 
> A check should still be added because if sbrk is used as the
> underlying mechanism, it takes a signed argument.  If you roll over
> INT_MAX then you will be passing a negative value to sbrk and thereby
> asking to release storage.  A test could be added in malloc_extend_top
> to check against MORECORE_MAX which can be defaulted to INT_MAX.

Is the attached, hopefully less intrusive, patch more acceptable?  Or,
is it just more ugly? :,)

Thanks,
Jason

Attachment: mallocr.c-2.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]