swift-crypto
swift-crypto copied to clipboard
Fix over-iterating buffer in hex string utility.
Fixes https://github.com/apple/swift-crypto/issues/139: over-iteration in hex string.
Checklist
- [x] I've run tests to see all new and existing tests pass
- [x] I've followed the code style of the rest of the project
- [x] I've read the Contribution Guidelines
- [x] I've updated the documentation if necessary
If you've made changes to gyb
files
- [x] I've run
.script/generate_boilerplate_files_with_gyb
and included updated generated files in a commit of this pull request
Motivation:
Upon discussing it in https://github.com/apple/swift-crypto/issues/139, an issue was identified that could cause unexpected hex output for a data buffer whose memory spans multiple non-contiguous regions.
Modifications:
Removed memory region specific logic. Fix applied to 3 copies of the same function.
Also added unit test on Apple platforms to compare with NSString
's hex output.
Result:
With multi-region DataProtocol
s, hexString
should return correct hex.
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?