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

G103: list of unsafe functions #1030

Closed
jeffreytolar opened this issue Oct 9, 2023 · 0 comments · Fixed by #1033
Closed

G103: list of unsafe functions #1030

jeffreytolar opened this issue Oct 9, 2023 · 0 comments · Fixed by #1033

Comments

@jeffreytolar
Copy link

calls: []string{"Alignof", "Offsetof", "Sizeof", "Pointer"},
has a list of four unsafe functions. Of those, I think only the last (Pointer) is really a (potential) security concern - Alignof, Offsetof, Sizeof don't (by themselves) bypass the type system or memory safety checks.

I suspect they're in unsafe primarily because they aren't portable - you can get different values when compiling for different platforms. See also golang/go#5602

There are some new-ish unsafe functions that do potentially have security implications:

  • unsafe.String (go1.20)
  • unsafe.StringData (go1.20)
  • unsafe.Slice (go1.17)
  • unsafe.SliceData (go1.20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant