[CoreFoundation] Fix incorrect cast in _CFRuntimeCreateInstance. #1806
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
_cfinfoa field of CFRuntimeBase is an _Atomic(uint64_t), but for some
reason it was being accessed from a uint32_t pointer (which I think
violates strict aliasing rules). This was working for little endian
architectures, but would have failed for big endian architectures when
writing the value back into the MSB instead of the LSB.
The fix uses the right size (64 bits) and removes the castings where
possible. However, to avoid the _Atomic to be honored, the field is
still casted to an uint64_t, which might hide future errors (like the
situation this is trying to fix).