* Go patch committed: check for invalid UTF-8 in line comments
@ 2015-08-31 3:36 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2015-08-31 3:36 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 293 bytes --]
This patch by Chris Manghane fixes the Go compiler to check for
invalid UTF-8 in line comments. Otherwise the compiler might pass a
file that it shouldn't. This fixes https://golang.org/issue/11527 .
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1121 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 227299)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-3aa2ea272e475010da8b480fc3095d0cd7254d12
+65672c16004c6d6d0247b6691881d282ffca89e3
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: gcc/go/gofrontend/lex.cc
===================================================================
--- gcc/go/gofrontend/lex.cc (revision 227299)
+++ gcc/go/gofrontend/lex.cc (working copy)
@@ -1689,6 +1689,16 @@ Lex::skip_cpp_comment()
&& memcmp(p, "line ", 5) == 0)
{
p += 5;
+
+ // Before finding FILE:LINENO, make sure line has valid characters.
+ const char* pcheck = p;
+ while (pcheck < pend)
+ {
+ unsigned int c;
+ bool issued_error;
+ pcheck = this->advance_one_utf8_char(pcheck, &c, &issued_error);
+ }
+
while (p < pend && *p == ' ')
++p;
const char* pcolon = static_cast<const char*>(memchr(p, ':', pend - p));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-31 1:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-31 3:36 Go patch committed: check for invalid UTF-8 in line comments Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).