diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-28 18:45:48 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-28 18:45:48 +0000 |
commit | 854f075ee0f6921abae33eca3936dcad5716ad26 (patch) | |
tree | 1d3f02bb630179f0bf2fe0b14fc0c2031d5a3f7a /libcpp | |
parent | 3ed99e5de728b21a09f911fa9a296d332c3aeed0 (diff) | |
download | gcc-854f075ee0f6921abae33eca3936dcad5716ad26.tar.gz |
PR preprocessor/30001:
* charset.c (_cpp_convert_input): Check that to.len is greater
than zero.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120245 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/charset.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index c189cd66b87..1b1f833b8d7 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2006-12-28 Tom Tromey <tromey@redhat.com> + + PR preprocessor/30001: + * charset.c (_cpp_convert_input): Check that to.len is greater + than zero. + 2006-11-20 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com> * configure.ac (need_64bit_hwint): Need 64bit hwint for SPU. diff --git a/libcpp/charset.c b/libcpp/charset.c index 78c89816735..d1323601bd1 100644 --- a/libcpp/charset.c +++ b/libcpp/charset.c @@ -1,5 +1,5 @@ /* CPP Library - charsets - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. Broken out of c-lex.c Apr 2003, adding valid C99 UCN ranges. @@ -1628,7 +1628,7 @@ _cpp_convert_input (cpp_reader *pfile, const char *input_charset, terminate with another \r, not an \n, so that we do not mistake the \r\n sequence for a single DOS line ending and erroneously issue the "No newline at end of file" diagnostic. */ - if (to.text[to.len - 1] == '\r') + if (to.len && to.text[to.len - 1] == '\r') to.text[to.len] = '\r'; else to.text[to.len] = '\n'; |