diff options
| author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-08 12:29:27 +0000 |
|---|---|---|
| committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-08 12:29:27 +0000 |
| commit | 00be0e55b2373e95eee33afda63b922917cfda56 (patch) | |
| tree | 3b7c3bc5223dc394703026186605b645907b3445 | |
| parent | 844eef3aa5682ed12c293538645843c1d6c9a9a9 (diff) | |
| download | ppe42-gcc-00be0e55b2373e95eee33afda63b922917cfda56.tar.gz ppe42-gcc-00be0e55b2373e95eee33afda63b922917cfda56.zip | |
PR bootstrap/12490
* scan-decls.c (MAX_EXTERN_C_BRACES): New preprocessor constant
to define the size of the extern_C_braces array. Set it to 200.
(scan_decls): Abort when extern_C_braces_length is out-of-bounds.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72224 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 8 | ||||
| -rw-r--r-- | gcc/scan-decls.c | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b2e01a6f67..72fd7ae770b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2003-10-08 Timo Kokkonen <tjko@iki.fi> + Eric Botcazou <ebotcazou@libertysurf.fr> + + PR bootstrap/12490 + * scan-decls.c (MAX_EXTERN_C_BRACES): New preprocessor constant + to define the size of the extern_C_braces array. Set it to 200. + (scan_decls): Abort when extern_C_braces_length is out-of-bounds. + 2003-10-08 Carlo Wood <carlo@alinoe.com> * Makefile.in (gengtype-lex.c): flex 2.5.4[a] doesn't understand diff --git a/gcc/scan-decls.c b/gcc/scan-decls.c index 14f64e8cb2e..ebd69cb05c1 100644 --- a/gcc/scan-decls.c +++ b/gcc/scan-decls.c @@ -34,7 +34,9 @@ int brace_nesting = 0; indicate the (brace nesting levels of) left braces that were prefixed by extern "C". */ int extern_C_braces_length = 0; -char extern_C_braces[20]; +/* 20 is not enough anymore on Solaris 9. */ +#define MAX_EXTERN_C_BRACES 200 +char extern_C_braces[MAX_EXTERN_C_BRACES]; #define in_extern_C_brace (extern_C_braces_length>0) /* True if the function declaration currently being scanned is @@ -220,6 +222,12 @@ scan_decls (cpp_reader *pfile, int argc ATTRIBUTE_UNUSED, brace_nesting++; extern_C_braces[extern_C_braces_length++] = brace_nesting; + if (extern_C_braces_length >= MAX_EXTERN_C_BRACES) + { + fprintf (stderr, + "Internal error: out-of-bounds index\n"); + exit (FATAL_EXIT_CODE); + } goto new_statement; } } |

