Skip to content

Conversation

bulbazord
Copy link

The implementation of the templated Get function contains UB. For example, the "GetDoubleUnaligned" unit test causes Get to perform an unaligned 8 byte read. This violates the double alignment requirement. Furthermore, it violates strict aliasing rules in C++. (We construct a const double * from a const uint8_t * and perform a read on the resulting double pointer).

DataExtractor should be able to read unaligned data to deal with different data formats, but we need to be careful to not perform unaligned reads/writes or violate strict aliasing rules.

rdar://160385383
(cherry picked from commit 40d4ea6)

The implementation of the templated `Get` function contains UB. For
example, the "GetDoubleUnaligned" unit test causes `Get` to perform an
unaligned 8 byte read. This violates the `double` alignment requirement.
Furthermore, it violates strict aliasing rules in C++. (We construct a
`const double *` from a `const uint8_t *` and perform a read on the
resulting double pointer).

DataExtractor should be able to read unaligned data to deal with
different data formats, but we need to be careful to not perform
unaligned reads/writes or violate strict aliasing rules.

rdar://160385383
(cherry picked from commit 40d4ea6)
@bulbazord
Copy link
Author

@swift-ci please test

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.

1 participant