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: lto/55474: global-buffer-overflow in lto-wrapper.c


On Tue, Nov 27, 2012 at 9:32 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2012.11.26 at 13:58 -0800, H.J. Lu wrote:
>> Hi,
>>
>> OPT_SPECIAL_unknown, OPT_SPECIAL_ignore, OPT_SPECIAL_program_name and
>> OPT_SPECIAL_input_file are special options, which aren't in cl_options.
>> This patch avoids
>>
>> if (!(cl_options[foption->opt_index].flags & CL_TARGET))
>>
>> on them.  This patch skips them.  OK to install?
>
> The same fix is necessary for gcc/lto-opts.c.
> This solves the issue from PR54795 comment 5, 13 and 20.

Ok for both patches.

Thanks,
Richard.

> 2012-11-27  Markus Trippelsdorf  <markus@trippelsdorf.de>
>
>         PR lto/54795
>         * lto-opts.c (lto_write_options): Also handle
>         OPT_SPECIAL_unknown, OPT_SPECIAL_ignore and
>         OPT_SPECIAL_program_name.
>
>
> diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
> index a235f41..a61a26f 100644
> --- a/gcc/lto-opts.c
> +++ b/gcc/lto-opts.c
> @@ -93,6 +93,20 @@ lto_write_options (void)
>      {
>        struct cl_decoded_option *option = &save_decoded_options[i];
>
> +      /* Skip explicitly some common options that we do not need.  */
> +      switch (option->opt_index)
> +      {
> +       case OPT_dumpbase:
> +       case OPT_SPECIAL_unknown:
> +       case OPT_SPECIAL_ignore:
> +       case OPT_SPECIAL_program_name:
> +       case OPT_SPECIAL_input_file:
> +         continue;
> +
> +       default:
> +         break;
> +      }
> +
>        /* Skip frontend and driver specific options here.  */
>        if (!(cl_options[option->opt_index].flags & (CL_COMMON|CL_TARGET|CL_LTO)))
>         continue;
> @@ -108,17 +122,6 @@ lto_write_options (void)
>        if (cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
>         continue;
>
> -      /* Skip explicitly some common options that we do not need.  */
> -      switch (option->opt_index)
> -       {
> -       case OPT_dumpbase:
> -       case OPT_SPECIAL_input_file:
> -         continue;
> -
> -       default:
> -         break;
> -       }
> -
>        for (j = 0; j < option->canonical_option_num_elements; ++j)
>         append_to_collect_gcc_options (&temporary_obstack, &first_p,
>                                        option->canonical_option[j]);
> --
> Markus


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