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

Nightly 3/10 asan use after free #7745

Closed
jgilbert2017 opened this issue Mar 25, 2022 · 2 comments · Fixed by #7780 or #7781
Closed

Nightly 3/10 asan use after free #7745

jgilbert2017 opened this issue Mar 25, 2022 · 2 comments · Fixed by #7780 or #7781

Comments

@jgilbert2017
Copy link

installed via freerdp-nightly_3.0.0+0~20220310024821.1096~1.gbp91ef44_amd64.deb

cmd line exec $xfreerdp /drive:home,/home/user/Documents /gdi:hw -wallpaper -themes $multi /size:100% /u:username /v:192.168.1.100 /rfx /gfx -clipboard +gfx-progressive /microphone:sys:alsa,format:1 /sound:sys:alsa

nightly 3/10 runs fine 99% of the time but just got a asan abort below during a graphical activity.

==1612==ERROR: AddressSanitizer: heap-use-after-free on address 0x7f41bcaa1d98 at pc 0x7f41c95fcd71 bp 0x7f41a1ec6f50 sp 0x7f41a1ec6f40
READ of size 2 at 0x7f41bcaa1d98 thread T24
    #0 0x7f41c95fcd70  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x384d70)
    #1 0x7f41c8f82f95  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x170f95)
    #2 0x7f41c8f8768d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17568d)
    #3 0x7f41c8bff608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477
    #4 0x7f41c8d3f162 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f162)

0x7f41bcaa1d98 is located 13720 bytes inside of 264040-byte region [0x7f41bca9e800,0x7f41bcadef68)
freed by thread T18 here:
    #0 0x7f41c9fcdc3e in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:163
    #1 0x7f41c95e9f37  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x371f37)
    #2 0x7f41c95eb4cb  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x3734cb)
    #3 0x7f41c95ff49c  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x38749c)
    #4 0x7f41c95fff9f  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x387f9f)
    #5 0x7f41c96044e3 in progressive_decompress (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x38c4e3)
    #6 0x7f41c940ea14  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x196a14)
    #7 0x7f41c99b967f  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0x12267f)
    #8 0x7f41c99bf902  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0x128902)
    #9 0x7f41c99c446a  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0x12d46a)
    #10 0x7f41c99377ea  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0xa07ea)
    #11 0x7f41c9939a45  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0xa2a45)
    #12 0x7f41c8f8768d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17568d)
    #13 0x7f41c8bff608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477

previously allocated by thread T18 here:
    #0 0x7f41c9fcdc3e in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:163
    #1 0x7f41c95e9f37  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x371f37)
    #2 0x7f41c9600f62 in progressive_create_surface_context (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x388f62)
    #3 0x7f41c940e84b  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x19684b)
    #4 0x7f41c99b967f  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0x12267f)
    #5 0x7f41c99bf902  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0x128902)
    #6 0x7f41c99c446a  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0x12d46a)
    #7 0x7f41c99377ea  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0xa07ea)
    #8 0x7f41c9939a45  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0xa2a45)
    #9 0x7f41c8f8768d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17568d)
    #10 0x7f41c8bff608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477

Thread T24 created by T18 here:
    #0 0x7f41c9efa815 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cc:208
    #1 0x7f41c8f8690d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17490d)
    #2 0x7f41c8f87c90 in CreateThread (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x175c90)
    #3 0x7f41c8f8324c  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17124c)
    #4 0x7f41c8f8354c in winpr_CreateThreadpool (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17154c)
    #5 0x7f41c961d152 in rfx_context_new_ex (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x3a5152)    #6 0x7f41c96084e7 in progressive_context_new (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x3904e7)
    #7 0x7f41c94e55de in freerdp_client_codecs_prepare (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x26d5de)
    #8 0x7f41c94132ef in gdi_graphics_pipeline_init_ex (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x19b2ef)
    #9 0x559d23c525e1  (/opt/freerdp-nightly/bin/xfreerdp+0x275e1)
    #10 0x7f41c8f2031a in PubSub_OnEvent (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x10e31a)
    #11 0x7f41c94d917f  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x26117f)
    #12 0x7f41c993c2e4  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0xa52e4)
    #13 0x7f41c8f8768d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17568d)
    #14 0x7f41c8bff608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477

Thread T18 created by T1 here:
    #0 0x7f41c9efa815 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cc:208
    #1 0x7f41c8f8690d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17490d)
    #2 0x7f41c8f87c90 in CreateThread (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x175c90)
    #3 0x7f41c9935a9d  (/opt/freerdp-nightly/bin/../lib/libfreerdp-client3.so.3+0x9ea9d)
    #4 0x7f41c94db750  (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x263750)
    #5 0x7f41c94d4b6a in freerdp_connect (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x25cb6a)
    #6 0x559d23c9ccd6  (/opt/freerdp-nightly/bin/xfreerdp+0x71cd6)
    #7 0x7f41c8f8768d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17568d)
    #8 0x7f41c8bff608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477

Thread T1 created by T0 here:
    #0 0x7f41c9efa815 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cc:208
    #1 0x7f41c8f8690d  (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x17490d)
    #2 0x7f41c8f87c90 in CreateThread (/opt/freerdp-nightly/bin/../lib/libwinpr3.so.3+0x175c90)
    #3 0x559d23c92086  (/opt/freerdp-nightly/bin/xfreerdp+0x67086)
    #4 0x559d23c4651c  (/opt/freerdp-nightly/bin/xfreerdp+0x1b51c)
    #5 0x7f41c8c440b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2)

SUMMARY: AddressSanitizer: heap-use-after-free (/opt/freerdp-nightly/bin/../lib/libfreerdp3.so.3+0x384d70)
Shadow bytes around the buggy address:
  0x0fe8b794c360: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c370: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c380: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c390: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c3a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0fe8b794c3b0: fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c3c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c3d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c3e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c3f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe8b794c400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==1612==ABORTING
@akallabeth akallabeth added this to the next milestone Apr 6, 2022
akallabeth added a commit to akallabeth/FreeRDP that referenced this issue Apr 6, 2022
akallabeth added a commit to akallabeth/FreeRDP that referenced this issue Apr 6, 2022
akallabeth added a commit to akallabeth/FreeRDP that referenced this issue Apr 6, 2022
akallabeth added a commit that referenced this issue Apr 6, 2022
(cherry picked from commit edcb828)
@VVD
Copy link

VVD commented Apr 26, 2022

What versions are affected?

@akallabeth
Copy link
Member

@VVD master before the merge, no releases.

mihainradu pushed a commit to UiPath/FreeRDP that referenced this issue Dec 7, 2022
hideyukn88 added a commit to microsoft/FreeRDP-mirror that referenced this issue Apr 26, 2023
* Changelog

* Added WINPR_ASSERT

Added a WinPR macro that can be used for WinPR and FreeRDP to
replace standard C assert.
It is more verbose and logs issues to WLog which makes it easier
for us to trace problems in the field.

(cherry picked from commit b435e6d)

* Added option do disable WINPR_ASSERT

(cherry picked from commit 3a75228)

* Improve WINPR_ASSERT, log backtrace

(cherry picked from commit 9e94f1d)

* Fixed warnings from WLOG_ASSERT

(cherry picked from commit 02896b0)

* Removed cached wlog pointer

(cherry picked from commit 7758046)

* Replaced WINPR_ASSERT defines, use include

* Updated changelog

* Use GetComputerName instead of gethostname

(cherry picked from commit 82165d9)

* Refactored WinPR::NTLM

* added assertions
* added log messages
* removed code duplication

(cherry picked from commit 813966d)

* Removed unnecessary assert

(cherry picked from commit 4b14276)

* Fixed NTLM flag handling

* NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED and NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED
* Problem with clients not supporting NTLMSSP_NEGOTIATE_LM_KEY
* Improve logging

(cherry picked from commit 3c657d5)

* Fixed backport compile problems

* Updated changelog

* Fixed missing return check

(cherry picked from commit 46c78cf)

* Fixed windows build (_snpnrintf)

(cherry picked from commit 6cccc95)

* Fixed missing field read.

(cherry picked from commit cb53811)

* Fixed FreeRDP#7745: Progressive surface cleanup

(cherry picked from commit edcb828)

* Updated changelog

* Urbrdc fix (FreeRDP#7417)

* fix libusb libusb_device usage (manually unref required usb devices, versus freeing all when we still hold references to the ones we want)
* disabled detach_kernel_driver & attach_kernel_driver on win32 since libusb does not support them
* fixed libusb async event handling

* add log for transfer request error

* Update libusb_udevice.c

* refactor code

* Fix FreeRDP#7785: Missed GatewayHttpUseWebsockets initialization

In backport FreeRDP#6877 this was missed.

* Fixed FFMPEG detection without pkgconfig

(cherry picked from commit 2c31c36)

* Supports 10bit X11 color (BGRX32 only)

(cherry picked from commit 8a86a4e)

* Changelog

* Fixed /gt:xxx settings

* Disable websocket support with RPC
* Use settings getter/setter

(cherry picked from commit 882b91d)

* Updated Changelog

* Update header with missing flag

Added definition for TS_RAIL_CLIENTSTATUS_GET_APPID_RESPONSE_EX_SUPPORTED.

* Added support for AUDIO_PLAYBACK_DVC

Support audio on dynamic channel. Please refer to MS-RDPEA.

* fix x11 black RAIL window when connect to server 2019

Signed-off-by: 2fly2 <wjatchd@163.com>
(cherry picked from commit cb66a4c)

* Changelog

* Update default android build config

Remove x86 and x86_64 to bring down pr build times

(cherry picked from commit 7e7394d)

* Cleaned up ntlm_fetch_ntlm_v2_hash

(cherry picked from commit 4661492)

* Implement BIO_CTRL_GET_KTLS_SEND and BIO_CTRL_GET_KTLS_SEND

Openssl 3.0 requires to respond to this controls. According to there
documentation it should not need them, but in practice openssl's own source
is full of places where negative return values are not checked.

(cherry picked from commit 9d7c20c)

* Updated changelog

* Added missing WINPR_API

* Updated for 2.7.0 release

* Added app_id on wayland client

(cherry picked from commit eaae909)

* Updated changelog

* Refactor thread condition logic

* Add better return value checks
* Combine logic blocks in structs
* Add (easier to read) static functions for blocks
* Use condition variables only in combination with BOOL

(cherry picked from commit a77038a)

* Do not mark WinPR implementation of ExitThread as noreturn

* Changelog

* Fixed leak in TestPipeCreateNamedPipeOverlapped.

(cherry picked from commit 1ee8370)

* Cleaned up NamedPipeOverlapped test.

(cherry picked from commit aeb2415)

* fix restore a maximized window when it is minimized

Signed-off-by: 2fly2 <wjatchd@163.com>
(cherry picked from commit ee8cf9e)

* Changelog

* Fixed FreeRDP#7837: Overallocate zgfx output buffers

Some decoders require additional byte alignment to prevent out
of bound reads

(cherry picked from commit ce60606)

* Updated changelog

* Follow up to FreeRDP#7832: Add NULL checks

(cherry picked from commit 8b9ab80)

* Fixed FreeRDP#7158: detection of arm neon.

(cherry picked from commit 6e075a6)

* Simplified CMake variable names

(cherry picked from commit bab6e3b)

* Moved execinfo backtrace to own file

* Moved windows backtrace to own file

(cherry picked from commit ca8c9ea)

* Moved corkscrew backtrace to own file

(cherry picked from commit 3ef29a3)

* Added unwind.h support

(cherry picked from commit b52416d)

* default android to unwind

(cherry picked from commit 734f906)

* Enable unwind.h and dladdr as default backtrace implementation

* config option USE_UNWIND to enable/disable

(cherry picked from commit 728d1c5)

* Updated changelog

* Only build RFX neon path with -DWITH_NEON=ON

(cherry picked from commit d18187c)

* Unified neon source options

(cherry picked from commit bfdbe18)

* Updated ios toolchain file with version from https://github.com/leetal/ios-cmake

(cherry picked from commit 0da860a)

* Update iOS openssl build

(cherry picked from commit ad04153)

* Removed obsolete toolchain file

* Fixed path of iOS toolchain file

(cherry picked from commit e53f0d7)

* Fixed argument mismatch

(cherry picked from commit 400fe6f)

* Defined and use _write

(cherry picked from commit 9330559)

* Removed manual IOS sysroot settings, let the toolchain file take care

* Fixed IOS timer detection

* Fixed IOS pthread_mutext_timedlock detection

* Fixed broken USE_UNWIND check

(cherry picked from commit 63a221d)

* fix moving a window shrinks it 14x7 when connect to server 2019

Signed-off-by: 2fly2 <wjatchd@163.com>
(cherry picked from commit e1e2eef)

* Fixed deprecated mac symbol

(cherry picked from commit 951a83e)

* Fixed memory leaks in rdpsnd mac

(cherry picked from commit b0772fe)

* changelog

* Android auto version code

(cherry picked from commit 6b7e167)

* Made WITH_MEDIACODEC configurable, use newer openssl

(cherry picked from commit 0c7e5fd)

* Updated openh264 and openssl versions

* Fixed memory leak in audin mac

(cherry picked from commit 24c87c5)

* changelog

* Use clang to build openh264

(cherry picked from commit c3787a7)

* Fixed compilation warnings

* Remove android version from freeRDPCore

* Updated gradle

* rdpsnd/client: Fix handling of WaveConfirm PDUs (FreeRDP#7910) (FreeRDP#7911)

Currently, all FreeRDP-based clients don't send any WaveConfirm PDUs
for received samples, when using a dynamic channel for audio output
redirection.
[MS-RDPEA] 2.2.3.8 Wave Confirm PDU mentions, that a WaveConfirm PDU
MUST be sent, when a WaveInfo PDU + Wave PDU, or Wave2 PDU is received
and when the audio data sample is emitted to completion by the client.
The first WaveConfirm PDU is used by the server to determine the
network latency and the second WaveConfirm PDU is used by the server to
determine the render latency.

So, fix the current behaviour, where FreeRDP currently does not send
any WaveConfirm PDU, when using the dynamic channel, or only sends one
WaveConfirm PDU for the sample.
For the first WaveConfirm PDU, use the same timestamp, that was
included in the first WaveInfo/Wave2 PDU.
For the second WaveConfirm PDU, add the render latency on top of the
arrival timestamp.

* Updated RDPGFX_CAPSET_VERSION106 code to conform to spec

(cherry picked from commit 6ea15d3)

* Add GFX 10.7 capsets

(cherry picked from commit 9190472)

* Disable scaled output PDU if no scaling support compiled

(cherry picked from commit 7e526e8)

* Changelog

* Fixed missing WINAPI for callback function declarations

(cherry picked from commit 3aca661)

* Fixed RDPGFX_CAPVERSION_106 according to errata

The [MS-RDPEGFX] spec is not really sure which value to use, so we
just announce both, the one from the spec and the one from errata.

(cherry picked from commit 8df9170)

* Removed recursive xf_lock_x11 warning

(cherry picked from commit 298d321)

* Fix return of getlogin()

(cherry picked from commit 1e779f9)

* core: server: add API to get peer accepted channel names

(cherry picked from commit 508ba92)

* Update ChangeLog

* Fixed format string for Stream_CheckAndLogRequiredLength

__LINE__ requires %d and not %PRIuz

(cherry picked from commit 74c1a00)

* rdpsnd: Enhance server implementation

The current server sided channel handling of RDPSND/AUDIO_PLAYBACK_DVC
is currently very constrained.
So, solve this. This means:

- Add the missing Training/Training Confirm PDUs
- Stop overriding the average bytes per second values, when submitting
  the audio formats, as this currently makes the usage of codecs
  impossible
- Add a way to send the server formats manually again, to be able to
  restart the protocol after a Close PDU was sent
- Add a way to send already encoded audio data to let server
  implementations to take care of the encoding process and to set
  custom audio timestamps for the Video Optimized Remoting channel
- Add public attributes to let server implementations know the initial
  volume and pitch values
- Add public attribute to let server implementations know the quality
  mode setting

(cherry picked from commit 26488911be9ae8e00f77f075e03ddbe4dc70a402)

* Refactored rdpsnd server

* Assert all input arguments
* Unify stream buffer handling

(cherry picked from commit 33ec06083130e45a0b5db012ff2975da8798db00)

* core/server: Add APIs to get notified of DVC creation statuses

This allows server implementations to add handling for situations,
where the client side does not support them.
Particularly useful for the audio output channels (static channel as
fallback, when dynamic channel is not supported).

* server/rdpsnd: Add API to get notified of channel id

* server: Add channel handling for telemetry channel

* audin/server: Do not overwrite values of the server audio formats

It just makes the usage of codecs impossible.

* channels/server: Add APIs for DVCs to get notified of channel id

This allows server implementations to watch these channel ids for their
creation statuses.

* Update changelog

* Add WTSChannelGetOptions

* Update ChangeLog

* Invert RDPGFX_CAPVERSION_106_ERR and RDPGFX_CAPVERSION_106 values

Define the actual value as RDPGFX_CAPVERSION_106 and the wrongly
documented one as RDPGFX_CAPVERSION_106_ERR

(cherry picked from commit a420179)

* Fix building with LibreSSL 2.7.0 or newer

With LibreSSL 2.7.0 (or newer versions) some more structs have made
opaque, which requires a few changes:

- BIO_meth_new() and related functions are now defined by LibreSSL, the
  versions from opensslcompat.{h,c} does not need to be used anymore.
- HMAC_CTX is now opaque, HMAC_CTX_new(), EVP_MD_CTX_new, and related
  functions should be used instead in winpr's hash.c.

* Improved RAIL order debug messages

(cherry picked from commit 44e7531)

* Added rail_get_order_type_string_full for better debug logs

(cherry picked from commit 79ba632)

* Added new rail orders textscaleinfo and caretblinkrate

(cherry picked from commit dfadfd3)

* Updated flags required by [MS-RDPERP]

(cherry picked from commit fc949e4)

* Added RAIL compartmentinfo server to client message

(cherry picked from commit ad6dd99)

* Removed duplicate defined symbols

stable has wnd.h defining this

* Unifiy string append functions

(cherry picked from commit f25261e)

* freerdp/constants: Conform osMinorType values to documentation

The OSMINORTYPE_NATIVE_WAYLAND value does not officially exist in
[MS-RDPBCGR].
Its value also is the one for Windows RT.

Fix this situation, by introducing the os minor type
OSMINORTYPE_WINDOWS_RT with its correct value and by choosing a
different value for OSMINORTYPE_NATIVE_WAYLAND, as that value does not
exist officially.

* constants: Add missing OS major type constants

* channels/server: Fix channel name in license comments

* telemetry/server: Fix copyright in license comment

* server: Add channel handling for camera device and enumerator channel

* Used C style struct init

* Fixed reserved symbol use in struct name

* Fix rdpecam server channel naming

* Renamed server channel to rdpei

* Use C style struct init

* Merged camera-device.h with existing rdpecam.h

* Reordered stream advance and length check, always add header byte length

* Fixed stream advance before length checks

* Fixed copyright headers and stream length

* Update changelog

* Fixed broken format string in rdg.c

(cherry picked from commit f55a420)

* Added debug logs

* Added missing include for ainput server channel

(cherry picked from commit ae49581)

* Fixed xf_Pointer_GetCursorForCurrentScale check

(cherry picked from commit a993db8)

* Update scaled pointer on FocusIn

(cherry picked from commit 5f0d4fb)

* Updated pointer debug log messages

(cherry picked from commit 7325119)

* Removed ALAW/ULAW from alsa/oss/pulse backends

The codec does not work reliably with some hardware.

(cherry picked from commit 7b02aba)

* Updated changelog

* freerdp/peer: Add APIs to get OS major and minor type strings

* winpr/clipboard: Allow overriding ValidFileNameComponent call

When using the wClipboard API, the connected peer might not be on the
Windows platform, where further filename restriction exists.
As a result, it is currently not possible to use the wClipboard API,
when intending to allow filenames, containing characters like ':'.

So, add a callback to the wClipboardDelegate, which is set to the
ValidFileNameComponent call by default.
This callback can be overridden by the API user, when it is known, that
there is no need to impose very strict filename restrictions.

* client/X11: Relieve CLIPRDR filename restriction when possible

Microsoft Windows imposes strict filename restrictions on its platform.
As RDP is developed by Microsoft and the RDS in MS Windows is typically
used as remote desktop server for the RDP protocol, these filename
restrictions are also enforced in WinPR, when copy-pasting files over
the clipboard.
However, in some connections no peer on MS Windows is involved and in
these situations, these filename restrictions are just an annoyance.

With a recent API addition in WinPR, it is now possible to override the
callback, where the filename is checked, whether it is valid.
So, use this new API to relieve the filename restriction, when the
connected remote desktop server is not on MS Windows.

* Update changelog

* Fixed xf_Pointer_GetCursorForCurrentScale double free

* [stable-2.0] codec/progressive: Fix wrong usage of subband diffing flag (FreeRDP#8077)

* codec/progressive: Fix wrong usage of subband diffing flag (FreeRDP#8076)

Currently, all Calista Progressive encoded streams contain tile
artifacts, when the RFX_SUBBAND_DIFFING is used, but not the
RFX_DWT_REDUCE_EXTRAPOLATE flag.
The reason is the wrong usage of the context and tile flags.
The RFX_SUBBAND_DIFFING flag should have no actual impact on the
decoder itself.
Especially, it does not affect the band sizes within a 64x64 tile.
The RFX_DWT_REDUCE_EXTRAPOLATE flag, on the other hand, MUST have an
effect on the band sizes.
However, FreeRDP currently uses the RFX_SUBBAND_DIFFING flag when
decoding a component to determine whether the Reduce-Extrapolate method
is used, resulting in tile artifacts, when that method was actually not
used.
The current behaviour did not result in tile artifacts with the MS
Windows RDS, as that server always sets both flags.

So, fix this issue by using the correct flag, when decoding a tile.

* Update changelog

* Moved clipboard utils to core library, fixes FreeRDP#6760 (FreeRDP#7752)

* Moved clipboard utils to core library, fixes FreeRDP#6760

(cherry picked from commit 4fb686d)

* Fixed compilation warnings in cliprdr_utils

(cherry picked from commit 8b7a086)

* Fixed backport API mismatch

* Added C++ guards to header

(cherry picked from commit 7626a2c)

* Backport TLS1.2 enforcement and version control from master to stable2.0 (FreeRDP#8094)

* Add a new command line arg to enforce tls1.2

* Add better explanation of FreeRDP_EnforceTLSv1_2

(cherry picked from commit ce2e3ab)

* Regenerated settings helpers

* backport prev cherry-pick

* Cleanup tls_prepare

* TLS version control

* added settings for minimal and maximal TLS versions supported
* refactorisation of the force TLSv1.2 setting

* cleanup from prev cherry-pick

* updated change log

Co-authored-by: akallabeth <akallabeth@posteo.net>
Co-authored-by: David Véron <david.veron@rubycat.eu>

* Release 2.8.0 (FreeRDP#8096)

* Backport: fix test create process (FreeRDP#8112)

* winpr: fix unitary test when CreateProcess is CreateProcessW

As the second argument of CreateProcessW is modified to split with spaces and so
this can not be a const arg.

* winpr: removed a C++ style comment

* Fix FreeRDP#8186: AVCodec split version defines in two files...

* Update changelog

* Updated flatpak manifest

* Use current dependencies
* Bundle OpenSSL 1.1.1 for windows  XP/vista/xp compatibility
* Build currently checked out FreeRDP instead of origin/master

(cherry picked from commit 541e8f8)

* Add flatpak bundle build script

* Builds the flatpak manifest (uses a temporary directory for
  intermediate files)
* Bundles the flatpak and writes it to the current directory

(cherry picked from commit 4a5d0df)

* Install required flathub remote and sdk automatically

(cherry picked from commit f013ebc)

* Enable PKCS11

(cherry picked from commit f1569c5)

* Disable execinfo support if only header detected

Some implementations (e.g. Android with API < 33) provide the
execinfo.h header file, but do not define the backtrace functions
expected. Disable the support for execinfo backtrace in such a case

(cherry picked from commit 09275bf)

* winpr/{libwinpr/thread/thread.c,include/winpr/thread.h}: Keep DumpThreadHandles as a symbol even if WITH_DEBUG_THREADS is OFF.

(cherry picked from commit 8ab9809)

* Updated changelog

* Fix length checks in parallel driver

The length requested was not checked against the length read from
the port.

(cherry picked from commit 094cc5a)

* Fixed missing length check in video channel

Data received in video redirection channel was not checked for
proper length.

(cherry picked from commit eeffd10)

* Fixed tsmf ffmpeg context extra data size checks

tsmf_ffmpeg_init_stream did not abort if the video format ExtraDataSize
was not sufficiently large to satisfy expectations.

(cherry picked from commit 5beef2c)

* Fixed missing input data length check

tsmf_ifman_exchange_capability_request did not check if the input
data stream actually contained the amount of bytes requested to
copy.

(cherry picked from commit 4182bfb)

* Fixed TSMF tsmf_ffmpeg_set_format length checks

ExtraDataSize of format was not checked for expected minimum length

(cherry picked from commit b7c0b43)

* Fixed TSMF tsmf_read_format_type length checks

ExtraDataSize of format was not checked for expected minimum
length

(cherry picked from commit dc88cfc)

* Fixed TSMF tsmf_gstreamer_set_format length checks

ExtraDataSize of format was not checked for expected minimum
length

(cherry picked from commit 136d92b)

* Fix FreeRDP#8176: Check fullscreen state and not setting

Timer based dynamic resolution updates are disabled in fullscreen
state. Check current value and not (permanent) setting

(cherry picked from commit a47dcd3)

* Send resize on window state change

(cherry picked from commit abbd1cd)

* changelog

* Fixes FreeRDP#7408

(cherry picked from commit a8e8069)

* Changelog

* Removed ALAW/ULAW from supported backend formats

pulse/alsa/oss do not reliably work with ALAW/ULAW codecs with all
hardware available.
Since these formats are poor quality anyway, deactivate them for
audin channel.

(cherry picked from commit c3e8720)

* Android build script updatee

* Remove JPEG build support (deprecated)
* Add sha256 check to tar/git checkout
* Update default dependency versions

(cherry picked from commit 7f13922)

* Updated version to 2.8.1

* Updated TestCryptoHash

Do multiple updates to hashes to better test implementation

(cherry picked from commit cfca31d)

* Added replacement MD4 implementation

(cherry picked from commit 095f1dc)

* Added replacement MD5 implementation

(cherry picked from commit e6bb4fa)

* Added replacement HMAC-MD5 implementation

(cherry picked from commit cd7dcf7)

* Updated changelog

* Improve OpenSSL provider loading

* Added log messages for failure to load a provider
* Add code to clean up loaded providers on shutdown

(cherry picked from commit 4db4b4c)

* Added missing include

(cherry picked from commit d48cd82)

* Added missing return in winpr_Digest_New

(cherry picked from commit 0ea1957)

* Check for NULL pointer in winpr_Digest_Free

(cherry picked from commit a806da9)

* Added support for audin version 2

(cherry picked from commit 6f62d30)

* Updated changelog

* Fixed compile error for old openssl

(cherry picked from commit f3082b3)

* Expose CONNECTION_STATE via public API

* Expose type CONNECTION_STATE
* Add getter freerdp_get_state
* Add helper freerdp_state_string

(cherry picked from commit 32b3f54)

* Added proxy input state sync (FreeRDP#7282)

The proxy server component might receive input related events
before the proxy client has established the connection to the
target machine.
With this change, the current keyboard state is cached and sent
to the target when it is ready. All input events received before
the target is ready are discarded.

(cherry picked from commit 4d23bc9)

* updated changelog

* Fixed division by zero in urbdrc

(cherry picked from commit 731f841)

* Ensure urb_create_iocompletion uses size_t for calculation

(cherry picked from commit de7e0f0)

* Fixed missing input buffer length check in urbdrc

(cherry picked from commit 497df00)

* Added missing length check in urb_control_transfer

(cherry picked from commit ce838e2)

* Added missing length checks in zgfx_decompress_segment

(cherry picked from commit 64716b3)

* Fixed missing stream length check in drive_file_query_directory

(cherry picked from commit 4e4bb79)

* Added function _wcsncmp

* Compare WCHAR strings up to n characters

(cherry picked from commit 8178ed2)

* [winpr, crt] Fix wcs*cmp and wcs*len checks

(cherry picked from commit b60fac1)

* [winpr, crt] Added wcsstr implementation

(cherry picked from commit 6c034ba)

* Fixed path validation in drive channel

Check that canonical path is a subpath of the shared directory

(cherry picked from commit 844c94e)

* [capabilities] properly set RemoteFxOnly

The check was inverted, setting the flag properly now

(cherry picked from commit 73a722e)

* [client,x11] Fixed FreeRDP#8397: Clamp scaled cursor sizes

If a cursor is scaled, ensure the result size is at least 1x1 pixel
wide.

(cherry picked from commit 0ebc468)

* Add support to send a ServerRedirection PDU.

(cherry picked from commit e35b032)

* Updated version to 2.9.0

* changelog

* Fix connection negotiation with mstsc/msrdc

mstsc/msrdc includes an optional correlation info
(RDP_NEG_CORRELATION_INFO) during connection negotiation. This confuses
FreeRDP which interpret this as a cookie and eventually fails the
negotiation, preventing a successful connection to these RDP client.

This commit addresses 3 things.

1) When processing connection token or cookie, skip if the remaining
bytes are neither.
2) After processing the RDP_NEG_REQ info, skip the optional correlation
info (RDP_NEG_CORRELATION_INFO) if one is present.
3) Allow local connection without server certificate when the client
inherently trust the server.

(cherry picked from commit 592f8d9)

* [channels,printer] Fixed reference counting

* [ntlm]: use rfc5929 binding hash algorithm

rfc5929 mandates some specific hashes for the binding algorithm

(cherry picked from commit 3a10bcd)

* [winpr,crypto] Split headers

Split windows API emulation from custom functions
Including both might yield issues with OpenSSL headers

(cherry picked from commit d03f230)

* [winpr,crypto] Split crypto header renamed

* Renamed custom winpr crypto function header
* Added compatiblity header

(cherry picked from commit 23f6366)

* [crypto] Added sha3 define guards

sha3 is only supported with OpenSSL 1.1.1a or later

(cherry picked from commit deaf2b6)

* [core,rdp] Add a check for broken RDP security

RDP security is rarely used nowadays, but there have been reports about
situations where the encryption key is missing.
Add this check to properly terminate the connection in case of such an
unexpected event.

(cherry picked from commit c895651)

* [core,rdp] Refactor rdp security encryption

Unify rc4 encryption key handling, use common free and reset functions

(cherry picked from commit 1304af4)

* [uwac] Add support for building against pixman

* [uwac] Fixed types and format strings

Do not rely on FreeRDP types, use inttypes.h and stdint.h supplied ones.

* [codec] fixed region16_union_rect

* If source and destination are equal, free the buffer on destination to
  avoid compiler warnings.
* Remove assert that is not required

(cherry picked from commit 646ecd3)

* [channel,urbdrc] fix type of usb hotplug callback

The libusb_hotplug_callback_fn uses LIBUSB_CALL call type

(cherry picked from commit c9b806b)

* [client,x11] Fixed FreeRDP#8099: Detect key autorepeat

When a key is pressed in autorepeat mode, skip the KeyRelease events in
between.

(cherry picked from commit c06317c)

* [core,info] enforce extended info limits

the cbClientAddress field limits defined in [MS-RDPBCGR]
2.2.1.11.1.1.1 Extended Info Packet (TS_EXTENDED_INFO_PACKET) are now
properly enforced.

(cherry picked from commit 268520f)

* [core,info] enforce cbClientDir limits

the cbClientDir field limits defined in [MS-RDPBCGR] 2.2.1.11.1.1.1
Extended Info Packet (TS_EXTENDED_INFO_PACKET) are now properly enforced.

(cherry picked from commit 66de09c)

* [core,info] ensure stream length

ensure the stream is large enough for all info packets

(cherry picked from commit daaec60)

* [core,info] improve rdp_read_info_null_string

* Removed comments with invalid assumptions
* Added arguments to rdp_read_info_null_string to indicate if the string
  is expected to be '\0' terminated and what is actually read for error
  logs

(cherry picked from commit 4fd3eb1)

* [build] add channel path to RPATH

some parts of freerdp link in channel libraries. if they are build with
-DBUILTIN_CHANNELS=OFF the libraries are not found in the proper RPATH
locations.

* [build] add missing link targets for BUILTIN_CHANNELS

* [build] add cmake definition `WITH_PLUGIN_RPATH_ONLY`

If we compile with `BUILTIN_CHANNELS`, we need to set up a run path
to `FREERDP_PLUGIN_PATH`, even if we avoid using RPATHs in general.
Supplying `-DWITH_PLUGIN_RPATH_ONLY=ON` will do this for you.

* revert changes so that the osmajortype/osminortype is not overwritten

* core/server: Ignore data PDUs for DVCs that were not opened successfully

When a FreeRDP-based server tried to open a DVC, but the client answered
the DVC create request with a negative CreationStatus in the DVC create
response PDU, the server can then assume that no actual PDUs can be
received for that channel.
However, as long as the channel handle exists, FreeRDP happily forwards
any potential PDU for that handle disregarding the CreationStatus.
This is problematic, since the channel handling usually runs in its own
thread and as a result, the channel may not be destructed yet, when
receiving such stray PDU.
The PDU may be processed, even though it is not expected to be.

A situation, where this becomes problematic is the AUDIO_PLAYBACK_DVC
channel.
It may be the case, that the client answered the DVC create request
with a negative result, the server may try to close the handle and open
the static channel (RDPSND) instead, but before the server can close the
channel handle, the client actually sends PDUs regarding the format
negotiation.
In this case, the server may unintentionally already set things up,
which was not desired (the DVC is about to be closed anyway).

While this specific situation is hypothetical, since it would depend on
a malicious client, it is still possible to happen, especially since the
server implementation does not invoke the format negotiation, but
FreeRDP does it automatically, as soon as the DVC create request is
sent.

Fix this issue by discarding any data PDUs (DYNVC_DATA_FIRST and
DYNVC_DATA) of channels, that were not opened successfully.

* Update changelog

* [uwac] do not use iso C functions

* [winpr,ntlm] fix NTOWFvxxxA functions

MultiByte string encoding lenght might differ from WCHAR encoding
length. Pass on proper lengths.

* [winpr,sam] fix inalid NULL arguments

(cherry picked from commit efa2adc)

* uwac/input: Set the right serial when setting cursor

The serial in wl_pointer.set_cursor must exactly match the one from
wl_pointer.enter, it should not use whatever serial for any input class
is the newest.

(cherry picked from commit b2cf6f5)

* uwac/input: Don't pass hotspot as offset when attaching cursor buffer

Passing a non-zero offset to cursor buffer and then calling
wl_pointer.set_cursor doesn't make much sense, as any offset will
immediately be reset. The protocol specifies the cursor set by
wl_pointer.set_cursor to be

> The parameters hotspot_x and hotspot_y define the position of
> the pointer surface relative to the pointer location. Its
> top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
> where (x, y) are the coordinates of the pointer location, in
> surface-local coordinates.

This leaves no room available for any previously set offsets to be kept
in response to wl_pointer.set_cursor.

(cherry picked from commit 5b09cd5)

* Fix incompatible function pointer types

clang 16+ is flagging the function pointer prototype mismatches,
therefore fix it.

Fixes Issue FreeRDP#8487

Signed-off-by: Khem Raj <raj.khem@gmail.com>

* [build,android] only use CMake from SDK

* only use CMake from android SDK
* abort if CMake or ndk-build are not detected
* update default OpenSSL

(cherry picked from commit de58995)

* Backported utils_str_*

(cherry picked from commit 50e9d3a)

* Cleaned up redirection code

(cherry picked from commit b545094)

* Added utility module for string functions

(cherry picked from commit 44582f8)

* [core,settings] add missing redirection options

* RedirectionGuid
* TargetCertificate

(cherry picked from commit a9482ca)

* [core] fix client side redirection handling

* Read previously ignored fields RedirectionGuid and TargetCertificate
* Check password requirements according to LB_PASSWORD_IS_PK_ENCRYPTED

(cherry picked from commit 968dfd7)

* [core,nla] refactor buffer use

Use helper functions to ensure buffers are properly freed up only once

* [core,redirect] refactor settings update

* [core,redirection] fix string read, cleanup logs

(cherry picked from commit 7eb332f)

* [release] updated version to 2.10.0

* [release] updated changelog

* Minor fixes on FreeRDP

* AF_VSOCK as local address
* GFX redirection
* Application List support

* Track `working` branch

* remove rdpapplist from FreeRDP project (#1)

Co-authored-by: Hideyuki Nagase <hideyukn@ntdev.microsoft.com>

* add Hebrew (Standard) keyboard layout ID (#3)

Co-authored-by: Hideyuki Nagase <hideyukn@ntdev.microsoft.com>

* merge fixes

* remove RDPAPPLIST references

* merge fixes

* build verification by Ubuntu-20.04

---------

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Co-authored-by: Armin Novak <armin.novak@thincast.com>
Co-authored-by: akallabeth <akallabeth@posteo.net>
Co-authored-by: Alexandru Bagu <alexandru.bagu@gmail.com>
Co-authored-by: Kazuki Oikawa <k@oikw.org>
Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: 2fly2 <wjatchd@163.com>
Co-authored-by: akarl <mike@mwsys.mine.bz>
Co-authored-by: Guillaume Démurgé <gdemurge@gmail.com>
Co-authored-by: Felix Deimel <office@lemonmojo.com>
Co-authored-by: Pascal Nowack <Pascal.Nowack@gmx.de>
Co-authored-by: kubistika <kmizrachi18@gmail.com>
Co-authored-by: Richard Dymond <rdymond@beyondtrust.com>
Co-authored-by: Adrian Perez de Castro <aperez@igalia.com>
Co-authored-by: akallabeth <akallabeth@users.noreply.github.com>
Co-authored-by: Siva Gudivada <98360053+sivagudivadaz@users.noreply.github.com>
Co-authored-by: David Véron <david.veron@rubycat.eu>
Co-authored-by: Bernhard Miklautz <bmiklautz@users.noreply.github.com>
Co-authored-by: David Fort <contact@hardening-consulting.com>
Co-authored-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Co-authored-by: James Fu <james.fu@hp.com>
Co-authored-by: fifthdegree <fifthdegree@protonmail.com>
Co-authored-by: Joan Torres <joan.torres@suse.com>
Co-authored-by: Hans-Peter Jansen <hp@urpla.net>
Co-authored-by: Armin Novak <anovak@thincast.com>
Co-authored-by: Jonas Ådahl <jadahl@gmail.com>
Co-authored-by: Khem Raj <raj.khem@gmail.com>
Co-authored-by: Vinicius Jarina <viniciusjarina@gmail.com>
Co-authored-by: Hideyuki Nagase <hideyukn@ntdev.microsoft.com>
Co-authored-by: Hideyuki Nagase <hideyukn@HIDEYUKN-SB3>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants