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

TestUnicodeConversion fails on big endian targets #6968

Closed
smaeul opened this issue Apr 20, 2021 · 1 comment · Fixed by #7219
Closed

TestUnicodeConversion fails on big endian targets #6968

smaeul opened this issue Apr 20, 2021 · 1 comment · Fixed by #7219

Comments

@smaeul
Copy link
Contributor

smaeul commented Apr 20, 2021

Describe the bug
The test added in #6803 is not endian-safe. The wide character literals are native endianness, however ConvertToUnicode always generates UTF16-LE.

To Reproduce
Steps to reproduce the behavior:

  1. Run the test suite on a big endian target.
  2. TestUnicodeConversion fails.

Expected behavior
The test suite passes.

Screenshots

(gdb) frame 0
#0  test_ConvertToUnicode_wrapper () at TestUnicodeConversion.c:416
416                     if (memcmp(wname, cmp, sizeof(cmp)) != 0)
(gdb) x/30c cmp
0x3fffffffebe2: 0 '\000'        115 's' 0 '\000'        111 'o' 0 '\000'        109 'm' 0 '\000'        101 'e'
0x3fffffffebea: 0 '\000'        116 't' 0 '\000'        101 'e' 0 '\000'        115 's' 0 '\000'        116 't'
0x3fffffffebf2: 0 '\000'        115 's' 0 '\000'        116 't' 0 '\000'        114 'r' 0 '\000'        105 'i'
0x3fffffffebfa: 0 '\000'        110 'n' 0 '\000'        103 'g' 0 '\000'        0 '\000'
(gdb) x/30c wname
0x3fffffffec00: 115 's' 0 '\000'        111 'o' 0 '\000'        109 'm' 0 '\000'        101 'e' 0 '\000'
0x3fffffffec08: 116 't' 0 '\000'        101 'e' 0 '\000'        115 's' 0 '\000'        116 't' 0 '\000'
0x3fffffffec10: 115 's' 0 '\000'        116 't' 0 '\000'        114 'r' 0 '\000'        105 'i' 0 '\000'
0x3fffffffec18: 110 'n' 0 '\000'        103 'g' 0 '\000'        0 '\000'        0 '\000'

Application details

  • FreeRDP version: master

Environment (please complete the following information):

  • OS: Gentoo Linux
  • Architecture: powerpc64-gentoo-linux-musl
@akallabeth
Copy link
Member

@smaeul we´re lacking big endian test targets, could you adjust the test and create a pull request for that?

floppym added a commit to floppym/FreeRDP that referenced this issue Aug 8, 2021
Long character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: FreeRDP#6968
floppym added a commit to floppym/FreeRDP that referenced this issue Aug 8, 2021
Wide character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: FreeRDP#6968
bmiklautz pushed a commit that referenced this issue Aug 16, 2021
Wide character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: #6968
floppym added a commit to floppym/FreeRDP that referenced this issue Aug 16, 2021
Wide character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: FreeRDP#6968
(cherry picked from commit 5208a67)
akallabeth pushed a commit that referenced this issue Aug 19, 2021
Wide character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: #6968
(cherry picked from commit 5208a67)
akallabeth pushed a commit to akallabeth/FreeRDP that referenced this issue Oct 15, 2021
Wide character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: FreeRDP#6968
(cherry picked from commit 5208a67)
akallabeth pushed a commit to akallabeth/FreeRDP that referenced this issue Oct 15, 2021
Wide character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: FreeRDP#6968
(cherry picked from commit 5208a67)
mfleisz pushed a commit that referenced this issue Oct 21, 2021
* Fixed typo in changelog

* Fix FIPS mode support and build with OpenSSL 3.0

FreeRDP fails to build with OpenSSL 3.0 because of usage of the `FIPS_mode`
and `FIPS_mode_set` functions, which were removed there. Just a note that
the FIPS mode is not supported by OpenSSL 1.1.* although the mentioned
functions are still there (see https://wiki.openssl.org/index.php/FIPS_modules).
Let's make FreeRDP build with OpenSSL 3.0 and fix the FIPS mode support.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1952937
(cherry picked from commit 26bf281)

* winpr: avoid calling FIPS_mode() with OpenSSL 3.0

Fixes: 26bf281
(cherry picked from commit 0c81c73)

* winpr/crypto: Load legacy provider to fix rc4 with OpenSSL 3.0 (#7210)

* winpr/crypto: Exit cleanly when EVP_EncryptInit_ex fails

The `EVP_EncryptInit_ex` function may fail in certain configurations.
Consequently, FreeRDP segfaults in `EVP_CIPHER_CTX_set_key_length`.
Let's handle the `EVP_EncryptInit_ex` failures and exit cleanly in
such case.

* winpr/crypto: Load legacy provider to fix rc4 with OpenSSL 3.0

Currently, the `EVP_EncryptInit_ex` function fails for rc4 with OpenSSL 3.0.
This is becuase rc4 is provided by the legacy provider which is not loaded
by default. Let's explicitly load the legacy provider to make FreeRDP work
with OpenSSL 3.0.

Relates: openssl/openssl#14392
Fixes: #6604
(cherry picked from commit 67f3fff)

Conflicts:
	winpr/libwinpr/crypto/cipher.c

* Fix TestUnicodeConversion on big endian machines (#7219)

Wide character literals are stored in native byte order.
Use an array of bytes as a reference instead.

Fixes: #6968
(cherry picked from commit 5208a67)

* Fixed async-input quit

* Fix data write on usb channel

* Bitmap update fix (#7349)

* Added checks for bitmap width and heigth values

Data received from the server might have invalid values for bitmap
with or height. Abort parsing if such a value is found.
Reported by Sunglin from the Knownsec 404 team & 0103 sec team

* Added checks for glyph width & height

* Fixed #7363: Length checks in ConvertUTF8toUTF16

(cherry picked from commit 623a772)

* Implemented missing TSG debug functions

(cherry picked from commit c06c463)

* Refactored RPC gateway parser

Utilize wStream instead of custom binary parsing code, add proper
input validation.
Reported by Sunglin from the Knownsec 404 team & 0103 sec team

(cherry picked from commit f0b44da)

* Replaced chmod with safer fchmod

* Use fchmod so the file may not change underneath
* Add unit tests for SetFileAttributesA
* Add warning logs for unsupported flags

(cherry picked from commit c8571dd)

* Updated changelog and version

* Added more explicit warning for deprecated command line

* Add exit codes for more errors

(cherry picked from commit aa4c3df)

* Updated changelog.

Co-authored-by: Ondrej Holy <oholy@redhat.com>
Co-authored-by: Mike Gilbert <floppym@gentoo.org>
Co-authored-by: Ondrej Holy <ondrejholy@users.noreply.github.com>
Co-authored-by: Ian Weir <mr.weir@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants