This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: PATCH: Fix assorted bounds violations



  In message <msn1hvod19.fsf@mcgary.org>you write:
  > > Or are we indeed resizing items within the realloc'd buffer too?
  > 
  > Yes, we are--at least for now.
OK.  I missed that.  Sigh.  How gross.

You should include a comment in the patch indicating that items inside
the realloc'd buffer are also being resized and thus need their bounds
updated.

With that comment I would consider the cpp patch OK.

  >     1) that this is a call to an allocator (the malloc attribute might
  >        be sufficient),
Right.  I'm not sure if we can (or even should) be marking the GGC
with a malloc attribute.  If we do, that might simplify this code.

  >     2) how to identify which args to the allocator bear on object
  >        size, and what formula computes the size.
I believe we can easily figure out this stuff for GGC allocated
items.  It almost makes me thing we should consider a way to tell
the BP code that a function is malloc-like *and* how to get the size
of the object allocated.

But in the short term, I guess your patch is OK.  Please install it.

Thanks,
jeff

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