Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gc compiler error: private methods can leak through interfaces #1550

Closed
griesemer opened this issue Feb 25, 2011 · 2 comments
Closed

gc compiler error: private methods can leak through interfaces #1550

griesemer opened this issue Feb 25, 2011 · 2 comments

Comments

@griesemer
Copy link
Contributor

Given an imported interface with a private method, a variable of that imported interface
type can be assigned to a local variable with a local interface type of the same
structure through the use of a type assertion. This makes it possible to call a private
method in another package.

The attached files document and illustrate the problem. To execute: copy the files p.go
and main.go into a new directory and run:

6g p.go && 6g main.go && 6l main.6 && 6.out

The output is:

main.Implementation.private()
p.Implementation.private()

but in fact it should not compile.

Attachments:

  1. p.go (187 bytes)
  2. main.go (1030 bytes)
@griesemer
Copy link
Contributor Author

Comment 1:

This issue may or may not be related to issue #1536.

Owner changed to r...@golang.org.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Apr 21, 2011

Comment 2:

This issue was closed by revision 5ff3336.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants