Changeset 2159 for trunk


Ignore:
Timestamp:
Jul 3, 2005, 12:56:38 AM (20 years ago)
Author:
bird
Message:

Fixed assertion during realloc(p, -256) to return failure instead. Added a few more overflow checks.

Location:
trunk/src/emx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/ChangeLog.LIBC

    • Property cvs2svn:cvs-rev changed from 1.82 to 1.83
    r2158 r2159  
    55        o Added obstack.h and it's implementation from GLIBC.
    66        o malloc and realloc must set errno to ENOMEM on failure.
     7        o Fixed assertion during realloc(p, -256) to return failure
     8          instead. Added a few more overflow checks.
    79
    8102005-07-01: knut st. osmundsen <bird-gccos2-spam@anduin.net>
  • trunk/src/emx/src/lib/malloc/irealloc.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r2158 r2159  
    7777  rsize = _UM_ROUND_LUMP (new_size);
    7878  nsize = (char *)_UM_ADD (lump, rsize) - (char *)seg->mem;
    79   assert (nsize > seg->size);
     79  if (nsize <= seg->size)
     80    return 0;
    8081
    8182  /* Attempt to expand the segment by calling EXPAND_FUN. */
     
    254255  struct _um_lump *slack;
    255256
     257  /* round the new size and make sure it doesn't accidentially wrap. */
     258  rsize = _UM_ROUND_LUMP (new_size);
     259  if (rsize < new_size)
     260    return NULL;
     261
    256262  h = seg->parent_heap;
    257263  _um_heap_lock (h);
     
    259265    flags |= _UMFI_TILED;
    260266  osize = _UM_ROUND_LUMP (lump->size);
    261   rsize = _UM_ROUND_LUMP (new_size);
    262267  r = _UM_BLOCK_FROM_LUMP (lump);
    263268  if (rsize < osize)
Note: See TracChangeset for help on using the changeset viewer.