aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-08-31 01:58:48 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-08-31 01:58:48 +0000
commit8f98def6b7d5b9bf3b23b91ff1833b76adff6cca (patch)
tree84e020cc8b23de586cd40a7e1d2d0c79cff07c38 /gcc/go
parentbabb13f5cc83ae685fdea4824a51f6de5345b2aa (diff)
downloadgcc-8f98def6b7d5b9bf3b23b91ff1833b76adff6cca.zip
gcc-8f98def6b7d5b9bf3b23b91ff1833b76adff6cca.tar.gz
gcc-8f98def6b7d5b9bf3b23b91ff1833b76adff6cca.tar.bz2
compiler: Check for invalid UTF8 in Go comments.
Fixes golang/go#11527. Reviewed-on: https://go-review.googlesource.com/13905 From-SVN: r227332
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/lex.cc10
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index beb095a..87ef518 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -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.
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc
index 632a1c9..67f7803 100644
--- a/gcc/go/gofrontend/lex.cc
+++ b/gcc/go/gofrontend/lex.cc
@@ -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));