Re: [libiberty] fix unbounded alloca in make_relative_prefix_1

2016-07-29 Thread Bernd Schmidt
On 07/29/2016 05:07 PM, Aldy Hernandez wrote: There is currently only one use, but I was thinking that perhaps if there were other alloca uses added later (I hope not), that they could all use the same macro. But I am more than happy to place this definition it in it's only use file for now, if t

Re: [libiberty] fix unbounded alloca in make_relative_prefix_1

2016-07-29 Thread Ian Lance Taylor
On Fri, Jul 29, 2016 at 5:30 AM, Aldy Hernandez wrote: > At least a cursory look at gcc/gcc-ar.c has us doing: > > self = getenv ("GCC_EXEC_PREFIX"); > ... > self_exec_prefix = make_relative_prefix (self, ... > > So the alloca() in make_relative_prefix() can be called with the strlen of > some

Re: [libiberty] fix unbounded alloca in make_relative_prefix_1

2016-07-29 Thread Bernd Schmidt
On 07/29/2016 02:30 PM, Aldy Hernandez wrote: +/* Max number of alloca bytes per call before we must switch to malloc. + + ?? Swiped from gnulib's regex_internal.h header. Is this actually + the case? This number seems arbitrary, though sane. + + The OS usually guarantees only one guard p

[libiberty] fix unbounded alloca in make_relative_prefix_1

2016-07-29 Thread Aldy Hernandez
At least a cursory look at gcc/gcc-ar.c has us doing: self = getenv ("GCC_EXEC_PREFIX"); ... self_exec_prefix = make_relative_prefix (self, ... So the alloca() in make_relative_prefix() can be called with the strlen of some random env var. Anyways... regardless... all unchecked alloca cal