aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-09-11 21:41:30 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-09-11 21:41:30 +0000
commit8500ff57774af2a6b3a08464a735f837a917b677 (patch)
tree97334c3e077e6891c0e34be9ae21974982d7472b /gcc/go
parentf2a4ca153cf04399eecdfb8229d63dda5754df95 (diff)
downloadgcc-8500ff57774af2a6b3a08464a735f837a917b677.zip
gcc-8500ff57774af2a6b3a08464a735f837a917b677.tar.gz
gcc-8500ff57774af2a6b3a08464a735f837a917b677.tar.bz2
compiler: Avoid unsafe memcmp for nointerface comments.
Fixes golang/go#11577. Reviewed-on: https://go-review.googlesource.com/14182 From-SVN: r227699
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/lex.cc4
2 files changed, 4 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 6c22440..ef21b54 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-352617bfe0a880febf5d2a87e89ea439c742ba18
+aea4360ca9c37f8e929f177ae7e42593ee62aa79
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 67f7803..98d98da 100644
--- a/gcc/go/gofrontend/lex.cc
+++ b/gcc/go/gofrontend/lex.cc
@@ -1752,7 +1752,9 @@ Lex::skip_cpp_comment()
// For field tracking analysis: a //go:nointerface comment means
// that the next interface method should not be stored in the type
// descriptor. This permits it to be discarded if it is not needed.
- if (this->lineoff_ == 2 && memcmp(p, "go:nointerface", 14) == 0)
+ if (this->lineoff_ == 2
+ && pend - p > 14
+ && memcmp(p, "go:nointerface", 14) == 0)
this->saw_nointerface_ = true;
while (p < pend)