From: ian Date: Fri, 11 Sep 2015 21:41:30 +0000 (+0000) Subject: compiler: Avoid unsafe memcmp for nointerface comments. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25646026fca066c5f37f899b53e7eee680567b8c;p=thirdparty%2Fgcc.git compiler: Avoid unsafe memcmp for nointerface comments. Fixes golang/go#11577. Reviewed-on: https://go-review.googlesource.com/14182 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227699 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 6c22440c234a..ef21b544a5fc 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 67f780342660..98d98da74ec0 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)