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

[SR-6515] Subdata of Data returned from URLSession is equal, but has different hash value #3776

Closed
florianreinhart opened this issue Dec 1, 2017 · 3 comments

Comments

@florianreinhart
Copy link

Previous ID SR-6515
Radar rdar://problem/35797359
Original Reporter @florianreinhart
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS 10.12.6, Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 01df9c9631c4bb86d147b910ef309d79

is duplicated by:

  • SR-6756 Another Data slice memory issue!
  • SR-6757 Data.enumerateBytes gives inconsistent indexes

Issue Description:

We use an HTTP API where the server returns a JSON object that contains a timestamp of the request in the first 32 bytes. However, the rest of the JSON content only changes every 30 minutes.

To check for changes of the content we ignore the timestamp by droppping the first 32 bytes and calculate the hash of the resulting subdata. For the subsequent request we do the same and compare both hash values. Unfortunately, they are not the same although both subdata instances are equal.

See the attached sample project to reproduce the issue.

The issue only occurs on macOS and not on Linux. Tested on:

macOS 10.12.6, Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)

Ubuntu 16.04, Swift version 4.0.2 (swift-4.0.2-RELEASE).

@belkadan
Copy link

belkadan commented Dec 1, 2017

@swift-ci create

@florianreinhart
Copy link
Author

@phausler I am unable to reproduce the issue with Swift 4.1 included with Xcode 9.3. Was this issue fixed in this PR: apple/swift#13280?

@belkadan
Copy link

Oops, yes, it was. (If not that specific commit, then one of the ones that made it into Swift 4.1.)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants