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

No endian safety #1

Open
dktapps opened this issue Apr 30, 2018 · 1 comment
Open

No endian safety #1

dktapps opened this issue Apr 30, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@dktapps
Copy link
Member

dktapps commented Apr 30, 2018

The vast majority of devices and machines these days are little-endian, but this extension doesn't consider the possibility of being compiled and run on a big-endian platform. If it is run on a big-endian platform, then lots of unpleasant things could occur, like word array corruption, generated chunks having the wrong byte order, client crashes, and so on and so forth.

Initial tests (with extra hacks to stop client crashes) yield the following results:
screenshot_20180430-193845
screenshot_20180430-194008

Since both disk saves and network sends are little endian, it would probably be best to have some big-endian-specific conversion code to translate little-endian packed byte arrays to/from big-endian in-memory format on the interfaces. This would produce some minor performance loss for big-endian platforms, but I think those are rare enough that nobody should really care.

@dktapps dktapps self-assigned this Apr 30, 2018
@dktapps dktapps added the bug Something isn't working label Apr 30, 2018
@ghost
Copy link

ghost commented May 17, 2018

In the meantime, you should throw an error on compilation for non-little-endian platforms

dktapps added a commit that referenced this issue Sep 6, 2020
21b69e5 Updating span section of Supported Features table.
d58e50c Merge pull request #922 from JordanMaples/constexpr-string_span
5fb0c86 constexpr string_span stuff
6c51863 Merge pull request #921 from JordanMaples/not_null-changes
4a4bb3c adding changes suggested by Jonathan Wakely
b6451c5 Merge pull request #920 from macjohnny/patch-1
81957f6 fix typo in readme
6aa755e Merge pull request #913 from jwakely/notnull_hash
e426750 Merge pull request #720 from menuet/fix-finally
c25a754 Fix finally with mutable lvalue invokable
06c4619 Merge pull request #910 from JordanMaples/exception_fix_new_file
83ce710 Merge pull request #807 from kuzkry/implemented_features
ec471ab Merge pull request #912 from jwakely/patch-1
dad3d80 Update README.md
a9ffcf7 add a table of features
e09326e Pass correct value to std::hash
d09f154 Fix comment typos
74968d3 Merge branch 'master' into exception_fix_new_file
0c80f51 Merge pull request #908 from JordanMaples/fix_nodiscard_in_finally_macro
ef714fa Merge pull request #676 from ericLemanissier/patch-3
9355982 Merge pull request #868 from mymedia2/master
4da6a26 forgot newline at eof.
2469db7 add copyright header
afe8244 change macro test to use __cplusplus instead of __has_cpp_attribute
72ddfb7 created new file for gsl_narrow, might want to rename if we go this approach to have all exception prone logic to live here
01eaf5b macro version
63379b7 Merge pull request #850 from beinhaerter/zstring_ctor
2231d73 zstring_span: fix for Expects, simplify functions
f8d9f2e Merge pull request #906 from TManhente/intel_suppress_fix
552eedb Merge pull request #881 from robert-andrzejuk/patch-1
ca3bf77 Fix  GSL_SUPPRESS definition on Intel C++ Compiler
559f8cf Merge pull request #899 from JordanMaples/dev/jomaples/cleanup_namespaces
f79ed1b Merge pull request #876 from beinhaerter/make_notnull_noexcept
bf6e103 Merge pull request #898 from JordanMaples/dev/jomaples/remove_pragma_push_pop
4c66cea remove gsl namespace qualification within the gsl namespace
478d876 remove pragma pop for constexpr macro
853b061 remove msvc < 1910 checks as those versions are no longer supported.
3010303 Merge pull request #897 from microsoft/JordanMaples-patch-1
be3bc0e Update README.md
98002ab Merge pull request #893 from xvitaly/fix-noarch
cfe9baf Added ARCH_INDEPENDENT parameter to write_basic_package_version_file().
0f6dbc9 Merge pull request #892 from JordanMaples/dev/jomaples/gsl3.1.0
78744ed update cmake project version to reflect upcoming GSL 3.1.0 release
794d7bb Merge pull request #891 from JordanMaples/dev/jomaples/missing_span_ctad
72803a7 adding template type to the vector to suppress clang-10 warning that vector may not intend for type deduction.
4d2090e fixed typo
c4a2ce6 wrapping string_view checks in deduction guide checks to prevent 'macro unused' errors
9720cc5 Merge pull request #6 from CaseyCarter/deduction_guides
c143a07 Add string_view test case and modify deduction guides
6c405a1 adding a test to verify that the additional ctad works
689abc2 adding container ctad
0dbdf32 Merge pull request #886 from JordanMaples/dev/jomaples/build_matrix
283e314 Merge pull request #857 from pps83/master-natvis
8cd1941 Merge pull request #887 from JordanMaples/dev/jomaples/p1976r2
25e7af9 fixing clang build break
7e4ed8d addressing Stephan's comments
3475081 updating table with compiler versions that are in the test matrix
313a112 fix spacing
1e44481 Finished integrating CaseyCarter's changes into span
ed3fea6 implementing some of Casey's recommendations
31604f4 string_span_tests CLRF -> LF
d346823 renaming extent to prevent shadowing of static member
552cd20 addressing most of Casey's comments
2085c7a initial impl of P1976R2
33544a7 revised the readme
f0160fc removing breaking test code. removing compiler versions n-2 and beyond from travis script. Updating XCode 11.3 to 11.4
2a483c1 Update span
0312314 pushing bad code that only reveals itself in gcc < 6 to test the allow_failures logic in travis
a6d3821 missed a GSL_CONSTEXPR_NARROW for removal
09caa20 changing matrices and removing msc < 1910 work arounds
0843ea4 Merge pull request #884 from dipidoo/master
1e4e237 updates README.md with iOS & Android support
839de21 Merge pull request #879 from leha-bot/cmake/add-version-to-cmake-project
91858ca forces GTEST_HAS_DEATH_TEST
0ab350f enables iOS and Android testing
8484704 In `narrow` refactor `!is_same_signedness` to `is_different_signedness`
1e5f44d Refactor `narrow` - simplify & move `is_same_signedness` into function, remove uneeded `detail` namespace. Merge 2 `if`'s with a `||`.
de05364 CMakeLists: Drop ARCH_INDEPENDENT as it does not supported via old CMake
29297e7 noexcept for make_(strict_)not_null and not_null comparisons
879335c CMakeLists: add VERSION to project() and package
1999b48 Merge pull request #870 from beinhaerter/suppress_span_warning
3da256d Merge pull request #874 from JordanMaples/dev/jomaples/multi_span-cleanup
601b55e Merge pull request #873 from londey/narrow-throw
3a5b83d Removed unused contant from test
94d6a35 Fixed narrow unit test EXPECT_THROW
14acdcd Removed unused #include
4eb554d Removed no_exception_throw_tests.cpp as per review feedback
70e1317 Update include/gsl/gsl
61534ca Changed implementation of gsl::narrow to throw gsl::narrowing_error Implementation now behaves as described in the C++ Core Guidlines
afa2f3f fully qualify ptrdiff_t in multi_span and remove it from gsl\gsl
fb1243d suppress code analysis warning
f5cf010 Search for GoogleTest via pkg-config first
9f6a9a5 Merge pull request #867 from xvitaly/fix-cmake-install
aeb65ef Fixed installation on GNU/Linux distributions.
b438556 Merge pull request #861 from JordanMaples/dev/jomaples/lwg3320
9cb376c adding back free functions for [c|cr][begin|end]
7341c5d implement LWG3320 by deleting const_iterator and const_reverse_iterator
044849d Merge pull request #823 from RedDwarf69/std_byte_fix
24dc828 Merge pull request #860 from karzhenkov/fix-googletest-link
8b8c25f Fix link to Google Test
f7aae78 Merge pull request #854 from JordanMaples/dev/jomaples/LWG3255
efbce17 testing one of CaseyCarter's comments
ffbfcc0 apply clang-format to the span_compatibility_tests.
5ca0232 another test
8d907da prevent comparison for apple clang versions older than 11
b7d9d75 another attempt at apple clang version filtering
809aee2 testing different major/minor for Apple suppression
6ef56d7 fixed a couple typos
2f9d873 added additional filtering to Apple clang versions 9.4 and 10.1 for the ArrayConvertibilityCheck
f85166a Merge branch 'master' into dev/jomaples/LWG3255
b0b933b Merge pull request #858 from Farwaykorse/patch-1
bc7ea7a Merge pull request #859 from Farwaykorse/patch-2
611674d GCC "-Warray-bounds" warning persists with release 8.4
6e2398b Solve MSVC warning C4668: __GNUC__ & __clang__ not defined as a preprocessor macro
ff45864 Merge branch 'dev/jomaples/LWG3255' of https://github.com/JordanMaples/GSL into dev/jomaples/LWG3255
15dd17a Merge branch 'master' into dev/jomaples/LWG3255
c5dd0e6 Merge pull request #3 from JordanMaples/dev/jomaples/lwg3255
01d206f adding additional filtering
830b081 Fix debugger visualizer for Ext=gsl::dynamic_extent
226a854 Merge pull request #835 from Farwaykorse/TravisCI
5e21831 Suppress test for GCC 8.3 triggering "-Warray-bounds"
04809f8 TravisCI: moved "based on" comment to relevant legacy section
511faf0 TravisCI: remove deprecated key "sudo" and replace alias "matrix" for "jobs"
610c403 TravisCI: add Clang-10
30c0687 Merge branch 'master' into TravisCI
f4c2292 Update to use the latest CMake releases
0357a02 Apply suggestions from code review
ddde9e1 update convertibility test
6eab19d moving decl so we dont get the stl_nullptr is not used warning
f8bcb7d applied clang-format
9b3ac8d discussed the issue with Casey Carter, the span ctor changes are accurate but the tests are not. The test require work that was done in C++17 regarding qualifier conversions to work correctly. Scoping tests for 17.
1dd1320 test commit to get extra eyes on the problem
d90fefe Merge pull request #851 from JordanMaples/dev/jomaples/exception
06adf55 update kernel mode detection macro
ce4d689 shuffle around code to bring includes to top.
b305240 added some comments and ran clang-format
769f019 moving exception include
4b64391 Merge pull request #784 from hanst99/hunterization
a3b8697 Merge pull request #847 from JordanMaples/dev/jomaples/split_span
4a6a7a0 add back array header, will remove in separate pr
d2fdeda Merge branch 'dev/jomaples/split_span' of https://github.com/jordanmaples/gsl into dev/jomaples/split_span
fc54e0d just pulling in array header if we detect apple clang
5d54cad just pulling in array header if we detect apple clang
32e5fea test
0f60c68 disgusting test to get apple clang to work, dont look at it
60372b6 apple-clang failed again, forcing class instead of struct
89271b8 fix apple clang forward declaration
ac37004 clang defines struct as array where msvc and g++ define it as class.
3144082 forward declare span and remove header
c853017 forgot nl @ eof in span_ext_tests.cpp
94f43d4 splitting up span's standard and non-standard behavior
691a78c Merge pull request #844 from JordanMaples/dev/jomaples/unsigned
4660369 rewrite operators in iterator to take advantage of nrvo
f4c608f addressing comments
8ba6cb1 Merge branch 'dev/jomaples/unsigned' of https://github.com/jordanmaples/gsl into dev/jomaples/unsigned
8d6ca32 GTest latest is breaking, rolling back to 1.10 until further investigation
6b01a04 Update span_compatibility_tests.cpp
b6b1e9c assert -> expect_true
67a7f7e errors in appveyor are indicating that AsWritableByesCompilersFor needs to be static.
41ae38f addressing a few more comments and adding gsl-std span compatibility tests
926aaec reviewed the pr in its entirety and made some slight modifications. Removed all members and fields marked as deprecated.
cce6ee5 address issue with v140 toolset
dd78144 msvc and gcc work locally
849f140 Add a note on CMake usage of exported target to the README
9c0c6b2 Add Microsoft.GSL::GSL alias for GSL
886fc95 Remove PUBLIC_HEADER attribute from `install` command
ebe8844 Make GSL includes based on CMAKE_INSTALL_INCLUDEDIR
d8fa68c address build failures
b81d6e4 constexpr the make_subspan calls.
377b2db almost parity with std::span
202f332 Merge pull request #845 from cbuchart/master
3f0d733 Fix incorrect package name for vcpkg
a49ff1b update span specialization of at, change some tests back to int i with narrowing for the comparisons.
3b9d15f reverting changes to gsl::index
45f016d add back capture variable for comparison in span_test
ff5f797 remove brackets around this deref for span_iterator operators
7fcc142 addressing travis errors
432be48 captureing result of iterator comparisons to address -Wunused-comparison
5cf1610 prevent overflow in size_bytes. fix compilation issue for clang 3.6 and 3.7
d7e1611 gsl::index ptrdiff_t -> size_t. remove span::at span::operator().
5a1e4f3 update index_type to size_type, fix a couple Expects
61c6ef8 remove index_type from string_span, update comments
db21344 Merge branch 'dev/jomaples/unsigned' of https://github.com/jordanmaples/gsl into dev/jomaples/unsigned
0c6ce42 refactoring index_type to size_type, changing expects
e9fea77 Update include/gsl/span
4ec7058 Update include/gsl/span
49e7ed1 updating comparisons
592c28c fixing spaces in gsl_suppress
877816f addressing feedback
2b7a8f1 Merge branch 'dev/jomaples/unsigned' of https://github.com/jordanmaples/gsl into dev/jomaples/unsigned
e0dc809 addressing feedback
81c2a1d addressing feedback
827fafd Update include/gsl/span
24646c6 Update include/gsl/span
f4ee6ee Update include/gsl/span
1815791 Change iterator from Span* & ptrdiff_t to pointer, pointer, pointer
d9d6ea8 remove comparison to dynamic_extent
3e40b3f Merge branch 'dev/jomaples/unsigned' of https://github.com/jordanmaples/gsl into dev/jomaples/unsigned
d0fdbdb fixing suppress spacing
a430823 Update include/gsl/string_span
9bb900e Update include/gsl/span
17e372c Update include/gsl/span
5b8cf54 casting -1 for dynamic extent
eabd935 addressing some comments
ad71477 fix build breaks
c31593d updating from test loop from int to size_t
8579165 change span from signed to unsigned to align to std
b4dd396 Merge pull request #842 from JordanMaples/dev/jomaples/not_null
6b23937 remove move constructor for not_null.
6e20bfb Merge pull request #836 from Farwaykorse/suppressionToCMake
57dd11b Merge pull request #840 from NancyLi1013/vcpkg-instructins
c61b150 Add vcpkg installation instructions
7ba7f87 Merge pull request #837 from Farwaykorse/fix/disable_exceptions
d976d41 Merge pull request #838 from kunaltyagi/patch-1
26a68c8 Correct spelling error in docs
95730a8 Restore disabling of exceptions for Microsoft STL in "no exception tests"
72312b6 Revert "adding /EHsc for msvc cmake target gsl_test_config_noexcept"
adc5fb0 TravisCI: use more bash variable checks
b29a18d TravisCI: use stages to end run when newest compilers fail
5082a21 TravisCI: keep googletest directories between CMake generator runs
8edc449 CMake 3.2.3 or later to use AppleClang on OSX
5caf336 TravisCI: validate CMake configuration with all supported releases
ecff9e6 TravisCI: performance - use the default CMake version on CI images
f828c55 TravisCI: add Clang-8 and 9
586c4e5 TravisCI: add GCC-8 and 9
e1a37d0 Suppress -Wundefined-func-template for C++17 Clang v5.0.x and AppleClang 9.1
f0061bf TravisCI: default to Ubuntu Bionic and use Xenial where needed
8655dc1 TravisCI: Xcode 9.0 earliest with C++17 support
d768179 TravisCI: add XCode v9.4, 10.1, 10.3 and 11.3
81f5679 MSVC and CoreChecker warning suppression for tests to CMake
4cbd894 Enable more warnings in GCC
d08ff53 Use [[maybe_unused]] with C++17
186f5d2 Move compiler warning suppression for tests from cpp files to CMake
cdedae8 TravisCI: remove redundant setting of CXX variable
888b9b9 Merge pull request #830 from JordanMaples/dev/jomaples/add_missing_span_functions
395a5bf Merge branch 'master' into dev/jomaples/add_missing_span_functions
96b6964 Merge pull request #829 from JordanMaples/dev/jomaples/deprecate_span_non_std_functions
a1e6fcb Merge branch 'master' into dev/jomaples/deprecate_span_non_std_functions
2d878b9 Merge branch 'master' into dev/jomaples/add_missing_span_functions
b076205 Merge branch 'dev/jomaples/deprecate_span_non_std_functions' of https://github.com/JordanMaples/GSL into dev/jomaples/deprecate_span_non_std_functions
75936c3 missed from the merge
cfd82ae deprecating span::at and span::operator()
3c0b38b Merge pull request #833 from JordanMaples/dev/jomaples/noexceptspan
2bc6a7c Merge pull request #825 from omartijn/free_standing_begin_end_ssize
c7f9b33 noexcepting new functions
6eccc81 Merge branch 'dev/jomaples/add_missing_span_functions' of https://github.com/JordanMaples/GSL into dev/jomaples/add_missing_span_functions
4b823b1 adding front and back
3bf4106 noexcept all of the span iterator stuff
fa8a811 Add tests for free-standing iterator and size functions
b186b6c Implement free-standing (c|r|cr)(begin|end) and ssize functions
b33bd4a updating all span functions to be noexcept
0fefba8 Merge pull request #832 from JordanMaples/dev/jomaples/buildfix
f04907c added suppression for missing destructor override
7786da9 Merge pull request #831 from JordanMaples/dev/jomaples/gtest
40bc3c3 testing something
8577033 addressing comments
3539bd8 adding /EHsc for msvc cmake target gsl_test_config_noexcept
17ad449 deprecate gsl::details::throw_exception. remove unused header in gsl_assert. gsl_util to use terminate instead of throw_exception
6c5c708 change from string to char*
0931262 appveyor failed to start, sending dummy commit
5099e8f removed string_view for string in tests
4f6f05d changing text in notices & readme. adding terminate handler for tests
ec05ecd dummy commit to trigger appveyor
0784866 added back death test, fixed VS2019 test failures
9a88262 fixing suppression of gtest warnings for gcc
b39a973 attempting to fix the gtest print issues in vs17
87eaa45 suppressing -Wundef in clang (GTest emitted)
43aca26 ignore warnings from gtest
603b467 removing unused function
2b10729 gtest migration
7004ef5 adding front and back
5e0d76a deprecating span::at and span::operator()
7e99e76 Merge pull request #826 from JordanMaples/dev/jomaples/ctad_fix_v2
263440f changing white-space in comment to get tests to rerun
a7759e6 lower __cpp_deduction_guide version number from 201907 to 201611
128b435 changing check from __cplusplus 201703L to __cpp_deduction_guides 201907L
8e481eb adding deduction guide for strict_not_null
4610f26 forgot comment
d0e5daf fix ctad warning in llvm
b213c89 Add missing #include if built with GSL_USE_STD_BYTE=1
9939d58 Merge pull request #822 from JordanMaples/dev/jomaples/lib-byte-check
22cba52 update comments
97dc8f8 adding check to __cpp_lib_byte, which was added to the defn for 15.8
71ec9f8 Merge pull request #2 from microsoft/master
3d56ba9 Merge pull request #813 from JordanMaples/dev/jomaples/deprecate_multispan
cf9cc34 Merge pull request #815 from matt77hias/patch-1
0a78d8e Added std::exchange (C++14) to make the intent more explicit
02d1051 Merge pull request #814 from sizmailov/fix_typos
275e017 Fix typos in gsl/pointers
4b289d4 lack of nl for bounds_test
6ff4a52 accidentally commented out pragma
2b8f7ae adding clang/gcc suppression of the deprecation warnings.
7adf7eb new messages
5e4463a removing function deprecation, adding additional class / struct deprecations
10ce5b6 Merge pull request #812 from JordanMaples/dev/jomaples/typo_fixes
eb995b3 deprecating strided_span
b630dfe Guideline -> Guidelines
e026971 deprecation, removing cassert
bbeb0bd initial deprecation of multi_span and strided_span
23066c8 Update README.md
a454d29 Merge pull request #803 from B1Z0N/master
ba9af38 Merge branch 'master' of https://github.com/B1Z0N/GSL
d5382a2 Fixed memory leaks
787e7ef Thanks to @stayprivates fixed out of bounds access in "TestNotNullostream"
1046c9d Merge pull request #1 from microsoft/master
b576cc6 Merge pull request #769 from jack17529/patch-1
2ce3177 Merge pull request #800 from eyalroz/master
cee1929 Fix GNUC typo (#780)
1d48188 Fixed check if std::byte is available (#764)
b05a446 Fixes #798 : Dropped inclusion of `gsl/pointers` in `string_span`.
1212bea Add Visual Studio 2019 image for tests (#787)
66809c6 make TypeListIndexer constexpr (#733)
0551cad Merge branch 'master' into hunterization
b74b286 add value_type size_type for string_span (#727)
2a1ef25 Update span
457fb25 Merge branch 'hunterization' of github.com:ithron/GSL into hunterization
8428e08 Merge branch 'master' into hunterization
73022d1 Merge branch 'master' into hunterization
ffe8ffb Dummy commit to force CI re-run
e3ffe1c Fix naming of exported CMake configuration file
e2b57d1 Export target GSL in namespace Microsoft.GSL
9e1645b Do not install .natvis files.
0a31a14 Fix INSTALL_INTERFACE for exported target
030454e Fix for Windows: CMake complains about INTERFACE_SOURCES directory
d452c3b Make library importable by CMake using find_package
423841e fix requirement on not_null template

git-subtree-dir: gsl
git-subtree-split: 21b69e5ccedb036ea3c0c6275519cbe51a8dbc03
dktapps added a commit that referenced this issue Sep 6, 2020
7e99e76 Merge pull request #826 from JordanMaples/dev/jomaples/ctad_fix_v2
263440f changing white-space in comment to get tests to rerun
a7759e6 lower __cpp_deduction_guide version number from 201907 to 201611
128b435 changing check from __cplusplus 201703L to __cpp_deduction_guides 201907L
8e481eb adding deduction guide for strict_not_null
4610f26 forgot comment
d0e5daf fix ctad warning in llvm
9939d58 Merge pull request #822 from JordanMaples/dev/jomaples/lib-byte-check
22cba52 update comments
97dc8f8 adding check to __cpp_lib_byte, which was added to the defn for 15.8
71ec9f8 Merge pull request #2 from microsoft/master
3d56ba9 Merge pull request #813 from JordanMaples/dev/jomaples/deprecate_multispan
cf9cc34 Merge pull request #815 from matt77hias/patch-1
0a78d8e Added std::exchange (C++14) to make the intent more explicit
02d1051 Merge pull request #814 from sizmailov/fix_typos
275e017 Fix typos in gsl/pointers
4b289d4 lack of nl for bounds_test
6ff4a52 accidentally commented out pragma
2b8f7ae adding clang/gcc suppression of the deprecation warnings.
7adf7eb new messages
5e4463a removing function deprecation, adding additional class / struct deprecations
10ce5b6 Merge pull request #812 from JordanMaples/dev/jomaples/typo_fixes
eb995b3 deprecating strided_span
b630dfe Guideline -> Guidelines
e026971 deprecation, removing cassert
bbeb0bd initial deprecation of multi_span and strided_span
23066c8 Update README.md
a454d29 Merge pull request #803 from B1Z0N/master
ba9af38 Merge branch 'master' of https://github.com/B1Z0N/GSL
d5382a2 Fixed memory leaks
787e7ef Thanks to @stayprivates fixed out of bounds access in "TestNotNullostream"
1046c9d Merge pull request #1 from microsoft/master
b576cc6 Merge pull request #769 from jack17529/patch-1
2ce3177 Merge pull request #800 from eyalroz/master
cee1929 Fix GNUC typo (#780)
1d48188 Fixed check if std::byte is available (#764)
b05a446 Fixes #798 : Dropped inclusion of `gsl/pointers` in `string_span`.
1212bea Add Visual Studio 2019 image for tests (#787)
66809c6 make TypeListIndexer constexpr (#733)
b74b286 add value_type size_type for string_span (#727)
2a1ef25 Update span

git-subtree-dir: gsl
git-subtree-split: 7e99e76c9761d0d0b0848b91f8648830670ee872
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant