MFC r258712;
libcpp: fix an underflow. Similar fix seen in Apple's gcc42. Obtained from: OpenBSD (Rev 1.2) MFC after: 2 weeks
This commit is contained in:
parent
4bda5ad442
commit
b8648b775a
@ -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 > 0 && to.text[to.len - 1] == '\r')
|
||||
to.text[to.len] = '\r';
|
||||
else
|
||||
to.text[to.len] = '\n';
|
||||
|
Loading…
Reference in New Issue
Block a user