Patchwork PATCH: lto/55474: global-buffer-overflow in lto-wrapper.c

login
register
mail settings
Submitter H.J. Lu
Date Nov. 26, 2012, 9:58 p.m.
Message ID <20121126215840.GA30771@intel.com>
Download mbox | patch
Permalink /patch/202038/
State New
Headers show

Comments

H.J. Lu - Nov. 26, 2012, 9:58 p.m.
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?

Thanks.


H.J.
---
2012-11-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR lto/55474
	* lto-wrapper.c (merge_and_complain): Handle
	OPT_SPECIAL_unknown, OPT_SPECIAL_ignore,
	OPT_SPECIAL_program_name and OPT_SPECIAL_input_file.

Patch

diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 1f4d212..24de743 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -393,6 +393,12 @@  merge_and_complain (struct cl_decoded_option **decoded_options,
       struct cl_decoded_option *foption = &fdecoded_options[i];
       switch (foption->opt_index)
 	{
+	case OPT_SPECIAL_unknown:
+	case OPT_SPECIAL_ignore:
+	case OPT_SPECIAL_program_name:
+	case OPT_SPECIAL_input_file:
+	  break;
+
 	default:
 	  if (!(cl_options[foption->opt_index].flags & CL_TARGET))
 	    break;