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]
Other format: [Raw text]

Re: [PATCH] Check the STRING_CSTs in varasm.c


On 08/01/2018 05:35 AM, Bernd Edlinger wrote:
> Hi,
> 
> this completes the previous patches, and adds a check in varasm.c
> that ensures that all string constants are NUL terminated,
> And that varasm does not strip anything but _exactly_ one NUL
> character.
> 
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
> 
> 
> Thanks
> Bernd.
> 
> 
> patch-varasm.diff
> 
> 
> 2018-08-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>
> 
> 	* varasm.c (check_string_literal): New checking function.
> 	(output_constant): Use it.
My biggest concern here is that we've explicitly defined STRING_CST
nodes as not needing NUL termination.  See generic.texi.  That explicit
definition is almost certainly derived from existing practice that long
pre-dates the introduction of gimple/generic.

Even so I'm generally OK with the concept of tightening the rules here.
If we need to fault in more fixes, that's fine with me.  I'm assuming
that you and Ian have sorted out what to do WRT Go.

If we decide to go forward, you'll definitely want to update the
STRING_CST documentation in generic.texi.

jeff


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