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

fixed overflow issue for x86 archs #8

Merged
merged 1 commit into from
Feb 13, 2018
Merged

fixed overflow issue for x86 archs #8

merged 1 commit into from
Feb 13, 2018

Conversation

Pirayya
Copy link

@Pirayya Pirayya commented Feb 13, 2018

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

Copy link
Owner

@pavlo-v-chernykh pavlo-v-chernykh left a 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)
Copy link
Owner

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)
Copy link
Owner

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)
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above

@Pirayya
Copy link
Author

Pirayya commented Feb 13, 2018

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!

@pavlo-v-chernykh
Copy link
Owner

@Pirayya , thanks for your contributions.

@pavlo-v-chernykh pavlo-v-chernykh merged commit 7bbcda7 into pavlo-v-chernykh:master Feb 13, 2018
@Pirayya Pirayya deleted the bugfix/int-overflow-on-x86-arch branch February 13, 2018 13:47
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.

Constant math.MaxUint32 overflows int on x86 arch
2 participants