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

remove AES cipher finalize call on tests #11

Merged
merged 2 commits into from
Feb 23, 2022
Merged

remove AES cipher finalize call on tests #11

merged 2 commits into from
Feb 23, 2022

Conversation

qmuntal
Copy link
Member

@qmuntal qmuntal commented Feb 18, 2022

Manually calling finalize() leads to double-freeing the cipher, which makes OpenSSL to panic.

finalize is not exported so there is no way this panic can be triggered from outside the library.

This behavior hasn't been seen in CI tests because it is only triggered when the garbage collector calls the AES cipher finalizer, and our tests do not run long enough to start the gc.

@@ -35,7 +35,6 @@ func TestNewGCMNonce(t *testing.T) {
if err != nil {
t.Errorf("expected no error for standard tag / nonce size, got: %#v", err)
}
c.finalize()
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a test to explicitly test the finalizer? (runtime.SetFinalizer(c, nil) and run it manually in the test body?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

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.

4 participants