-
Notifications
You must be signed in to change notification settings - Fork 37
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
fixed overflow issue for x86 archs #8
fixed overflow issue for x86 archs #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Pirayya , could you make fixes according to comments and I'll merge it then.
Let's make it a little bit sexier 😉
encoder.go
Outdated
@@ -98,7 +98,7 @@ func (kse *keyStoreEncoder) writeCertificate(cert *Certificate) error { | |||
return err | |||
} | |||
certLen := len(cert.Content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think wrapping uint64(len(cert.Content))
would be enough.
Could you fix it and I'll merge it then.
encoder.go
Outdated
@@ -150,7 +150,7 @@ func (kse *keyStoreEncoder) writePrivateKeyEntry(alias string, pke *PrivateKeyEn | |||
return err | |||
} | |||
privKeyLen := len(encodedPrivKeyContent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
encoder.go
Outdated
@@ -162,7 +162,7 @@ func (kse *keyStoreEncoder) writePrivateKeyEntry(alias string, pke *PrivateKeyEn | |||
return err | |||
} | |||
certCount := len(pke.CertChain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
Thanks @pavel-v-chernykh for the quick check! Much sexier fix 😄, I updated the branch with a new commit which should be more satisfactory! I forced push, sorry for that! |
@Pirayya , thanks for your contributions. |
fixes #7
Not the most sexy fix but will take two memory slots on x86 and the conversion in 64bit arch int to uint64 should not overflow