swift-crypto icon indicating copy to clipboard operation
swift-crypto copied to clipboard

Fix over-iterating buffer in hex string utility.

Open VaslD opened this issue 2 years ago • 7 comments

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 DataProtocols, hexString should return correct hex.

VaslD avatar Jan 10 '23 14:01 VaslD

Can one of the admins verify this patch?

swift-server-bot avatar Jan 10 '23 14:01 swift-server-bot

Can one of the admins verify this patch?

swift-server-bot avatar Jan 10 '23 14:01 swift-server-bot

Can one of the admins verify this patch?

swift-server-bot avatar Jan 10 '23 14:01 swift-server-bot

Can one of the admins verify this patch?

swift-server-bot avatar Jan 10 '23 14:01 swift-server-bot

Can one of the admins verify this patch?

swift-server-bot avatar Jan 10 '23 14:01 swift-server-bot

Can one of the admins verify this patch?

swift-server-bot avatar Jan 10 '23 14:01 swift-server-bot

Can one of the admins verify this patch?

swift-server-bot avatar Jan 10 '23 14:01 swift-server-bot