Skip to content

fix(ber): prevent race due to unnecessary var #24

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

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

seinshah
Copy link

address #23

Name of feature:

Fix race conditions in ber file

Pain or issue this feature alleviates:

Prevent race condition due to async access to ber's debugging global variable

Why is this important to the project (if not answered above):

Projects that use this package and run go test ./... -race will probably end up in situation like below:

WARNING: DATA RACE
Read at 0x0000021c46a0 by goroutine 33:
  github.com/smallstep/pkcs7.asn1Structured.EncodeTo()
      /.../vendor/github.com/smallstep/pkcs7/ber.go:21 +0x56
  github.com/smallstep/pkcs7.(*asn1Structured).EncodeTo()
      <autogenerated>:1 +0xa5
  github.com/smallstep/pkcs7.ber2der()
      /.../vendor/github.com/smallstep/pkcs7/ber.go:68 +0xdb
  github.com/smallstep/pkcs7.Parse()
      /.../vendor/github.com/smallstep/pkcs7/pkcs7.go:171 +0x12f

@CLAassistant
Copy link

CLAassistant commented Apr 11, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@hslatman hslatman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK for now. It might be useful to be able to debug the output, but we probably can implement a better solution, if needed.

@hslatman hslatman merged commit a82ada2 into smallstep:main Apr 11, 2024
@hslatman hslatman linked an issue Apr 11, 2024 that may be closed by this pull request
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 this pull request may close these issues.

Resolving Data Race
3 participants