This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PATCH 3/11] Add MIPS_MAX_REGISTER_SIZE (4/4)


On Fri, 9 Jun 2017, Pedro Alves wrote:

> >  Hardcoding things, and especially with literals, causes a maintenance 
> > pain when things change.  Bad code elsewhere is not an excuse; besides, 
> > the other places where `8' is hardcoded are not (buffer) limits, but just 
> > handle specific register sizes, which are not going to change, and which 
> > are a completely different matter. 
> 
> Perhaps you won't be surprised to learn that I subscribe to the same general
> principles.  However, I believe that this isn't, in fact, a completely
> different matter, because the buffer in question is used to hold the
> contents of a structure's address, to either put in a general register,
> or in a stack slot, and those (addresses and general registers), unlike FPRs,
> aren't expected to grow for a given architecture.

 Well, apart from being a software bug a buffer overflow is a potential 
security concern, while an unhandled particular object kind is only a bug.

> > So if you find `alloca' unacceptable, 
> > then the limit has to be a macro, and an assertion check is also due (as 
> > already proposed), preferably using `sizeof', so that a future change does 
> > not break it by accident.
> 
> I think a patch like the below is likely to clarify things.
> (Builds, but is otherwise untested).

 LGTM; fairly mechanical.  Thanks!

  Maciej


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