Skip to content

Commit 2564602

Browse files
author
ian
committed
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
1 parent 01e5628 commit 2564602

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

gcc/go/gofrontend/MERGE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
352617bfe0a880febf5d2a87e89ea439c742ba18
1+
aea4360ca9c37f8e929f177ae7e42593ee62aa79
22

33
The first line of this file holds the git revision number of the last
44
merge done from the gofrontend repository.

gcc/go/gofrontend/lex.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,9 @@ Lex::skip_cpp_comment()
17521752
// For field tracking analysis: a //go:nointerface comment means
17531753
// that the next interface method should not be stored in the type
17541754
// descriptor. This permits it to be discarded if it is not needed.
1755-
if (this->lineoff_ == 2 && memcmp(p, "go:nointerface", 14) == 0)
1755+
if (this->lineoff_ == 2
1756+
&& pend - p > 14
1757+
&& memcmp(p, "go:nointerface", 14) == 0)
17561758
this->saw_nointerface_ = true;
17571759

17581760
while (p < pend)

0 commit comments

Comments
 (0)