Skip to content

Commit

Permalink
PR preprocessor/30001:
Browse files Browse the repository at this point in the history
	* 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
  • Loading branch information
tromey committed Dec 28, 2006
1 parent 3ed99e5 commit 854f075
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions libcpp/ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions libcpp/charset.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 854f075

Please sign in to comment.