Commit Graph

483 Commits

Author SHA1 Message Date
Armin Novak
09111c9270 libfreerdp: Fixed warnings, added assertions 2021-06-18 11:32:16 +02:00
Armin Novak
2e0d1cc33c Fixed integer warnings, fixed data types 2021-06-17 10:35:22 +02:00
Armin Novak
959923c633 Fixed codeQL warnings 2021-06-08 08:21:47 +02:00
Armin Novak
c5fded2d83 Improved runtime of unit tests 2021-06-08 08:21:47 +02:00
Armin Novak
4f4e546cd4 Fixed initial alpha values for codec buffers 2021-06-01 14:18:01 +02:00
Biswapriyo Nath
173ab04b59 Use same data types as calling function prototypes. 2021-05-31 13:38:19 +02:00
sss
6b76ac9545 Revert "Revert "allow to use in single threaded mode" (#6864)"
This reverts commit f7465af44f.
2021-03-26 11:50:45 +01:00
Armin Novak
cf09443c43 Added bounds checks to gfx commands 2021-03-12 10:52:04 +01:00
akallabeth
f7465af44f
Revert "allow to use in single threaded mode" (#6864)
This reverts commit bee2e1526d.
2021-03-05 13:02:38 +01:00
Gluzskiy Alexandr
bee2e1526d allow to use in single threaded mode
(some client side channels and all server side channels still need to be
ported to new api)

server: build fix, do not disable threads for rfx encoder

cliprdr client channel: implemented support for DisableThreads option
looks like thread does not make sense at all for this channel

do not initialize disabled image codecs (respect settings)

channels: client: rail: added support for DisableThreads setting

changed "BOOL DisableThreads" to "UINT32 ThreadingFlags"
dropped unnecessary apu changes

draft implementation of threading settings aware message handling api
for addins/channels

rail: use new messaging api

fixed memory leak

msgs handlers external api changes (as requested)

msgs_handlers: init fix

fixed memory leak

logic fix

resolved problems appeared after rebase to master, dropped unnecessary
changes

git clang-format origin/master

fixed TestFreeRDPCodecRemoteFX.c

"formatting, run `clang-format` please"

properly use new "rfx_context_new(BOOL, UINT32)" everywhere

passed Threading Flags to "rfx_context_new" where available

in older C standarts veriables declaration must be done before any code

requested changes

clang-format as requested

use broken signatures of standert C functions for m$ s**tos

clang-format

requested changes

requested changes

moved ThreadingFlags to stable api zone

define type for channel msg handler

typo fix

clang-format

build fix

us ThreadingFlags from server settings

git clang-format origin/master

clang-format
2021-02-25 14:05:40 +01:00
akallabeth
43311130a2 Fixed CodeQL warnings 2021-02-19 11:19:49 +01:00
akallabeth
da938a6514 Only update destination rect for SurfaceToSurface and SurfaceToCache 2021-02-16 16:44:41 +01:00
Armin Novak
65647d5763 Use separate codec contexts for legacy and GFX 2021-02-10 10:38:24 +01:00
Vic Lee
a1566574a3 progressive: fix multiple regions in one gfx frame. 2021-02-04 09:16:23 +01:00
Armin Novak
8187ab7732 Fix ColorFidelity use 2021-01-18 09:41:13 +01:00
akallabeth
130561c9fc Removed size change check from DesktopResize
Just pass on every reset event from the server, the callback might
need to reset internal state even if the resolution did not change.
2020-12-22 13:00:54 +01:00
kubistika
50c09db081 reset codecs in gdi_pipeline_init 2020-12-01 13:10:45 +01:00
akallabeth
e08a23f931 Fixed missing input sanitation for GFX surfaces.
Thanks to Sunglin and HuanGMz of the Knownsec 404 security team and pangzi of pwnzen
2020-07-20 14:11:36 +02:00
akallabeth
f753c25ad3 Reset freed HGDI_DC
CVE-2020-4031 thanks to @antonio-morales for finding this.
2020-06-22 11:51:39 +02:00
Ondrej Holy
230d83b319 gdi: Fix missing unlock
This fixes the following defect reported by covscan tool:
libfreerdp/gdi/gfx.c:144: missing_unlock: Returning without unlocking "update->mux".
2020-06-04 07:55:12 +02:00
akallabeth
a9daba0190 Check for int overflow in gdi_InvalidateRegion 2020-04-09 18:00:51 +02:00
akallabeth
a3996af062 Refactored gdi region
* Added a unit test
* Fixed const correctness of function arguments
* Added return values for all functions
2020-04-09 18:00:51 +02:00
akallabeth
b677b5db25 Proper error return from gdi_rect_str and gdi_regn_str 2020-04-09 18:00:51 +02:00
akallabeth
e075f348d2 Added debug logging and claping to all region functions 2020-04-09 18:00:51 +02:00
akallabeth
ce21b9d7ec Fix CVE-2020-11523: clamp invalid rectangles to size 0
Thanks to Sunglin and HuanGMz from Knownsec 404
2020-04-09 18:00:51 +02:00
Norbert Federa
17e0d25104 dynvc/client: fix and improve channel closing code
- fixed and consolitate the duplicated code for sending the
  CLOSE_REQUEST_PDU to the server into dvcman_close_channel
- call dvcman_close_channel if a dynamic channel plugin fails
  to process the received channel data
- rdpegfx: don't try to remove a non-existing cache entry,
  return an error instead which now will close the channel, as
  expected by Microsoft's windows protocols test suite
2020-03-04 08:03:56 +01:00
Norbert Federa
ceb015a6bb egfx: the gfx reset grahics pdu is optional
Since the EGFX Reset Graphics PDU seems to be optional,
the graphicsReset variable (which is updated in that PDU's handler)
should be removed from the rdp_gdi struct with the next change
in public headers (as in freerdp v3).
There are still some clients that expect and check it and therefore
we keep it for now, initialized with TRUE.

sdas
2020-02-26 13:57:12 +01:00
Kobi Mizrachi
2d9a50fafb fix memory leaks in disp server and gfx.c 2020-01-13 13:41:44 +01:00
Martin Fleisz
71feb974ac
Merge pull request #5739 from akallabeth/improve_function_hiding
Improve function hiding
2019-12-02 11:31:35 +01:00
Armin Novak
7c243da6e1 Remove symbols exported by accident. 2019-12-02 10:57:31 +01:00
Armin Novak
c7337f4b6b Added data length check for RDP_CODEC_ID_NONE 2019-11-28 08:08:30 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak
f01e042211 Code cleanups (strlen, casts, size_t, ...) 2019-10-29 11:58:43 +01:00
Armin Novak
5cdb7b7bea Fix gdi coordinate clamping. 2019-10-25 12:58:14 +02:00
asapelkin
82eadad4a4 Fix some static analizer warnings 2019-10-22 15:39:54 +02:00
Armin Novak
441fb4d0ca Allow freerdp clients to function with WITH_OPENH264_LOADING
If no library can be loaded at runtime ignore H264 capabilities.
This allows a build with only OpenH264 support and dynamic loading
enabled to function when no openh264 library was detected.
2019-10-07 09:31:20 +02:00
Armin Novak
d49adfcf59 Fixed warnings and cleaned up gfx related xfreerdp code. 2019-05-08 17:01:36 +02:00
Martin Fleisz
50566c2171
Merge pull request #5385 from akallabeth/some_unused_parameter_silenced
Some unused parameter silenced
2019-05-08 14:16:05 +02:00
Martin Fleisz
e4a9172e13
Merge pull request #5383 from akallabeth/gfx_spec_update
Updated GFX to 10.6 spec
2019-05-08 13:42:50 +02:00
Armin Novak
ca4a1d19a5 Silenced some unused parameter warnings. 2019-05-08 12:21:31 +02:00
Armin Novak
3d1cec894c Fixed alignment requirements for surface sizes. 2019-05-08 10:36:00 +02:00
Armin Novak
3b7e46fb0e Updated GFX to 10.6 spec 2019-05-07 12:10:13 +02:00
Armin Novak
2a26aa0d87 Unified update->BeginPaint and update->EndPaint
Since these functions were called from 2 different threads
(main thread or dynamic channel) depending on fastpath or
gfx channel use lock between these.
If not locked the invalid region may be accessed from both
threads and lead to crashes as experienced with nightly df280a7ff
2019-04-11 15:33:23 +02:00
Armin Novak
ba40c971d2 Fixed sign-compare warnings 2019-04-05 09:13:24 +02:00
Armin Novak
696390f027 Fixed missing return value check. 2019-04-05 09:13:24 +02:00
Armin Novak
e8c8e7b6d0 Updated EGFX support to 10.6 2019-02-27 16:36:15 +01:00
Armin Novak
0c13c3199e Follow up to #4959: Lock gdi_UpdateSurfaces like xf_UpdateSurfaces 2018-12-04 16:56:22 +01:00
Armin Novak
2e019b2fd1 Implemented GFX locking and enforce return value checks.
To fix #4825 GFX functions must now aquire a lock before accessing surfaces.
This prevents simultaneous update of internal data by client and gfx threads.
Also enforce return value checks, where not already done.
2018-11-29 11:55:27 +01:00
Armin Novak
d06c3980a0 Fixed error log for avc420_decompress failures. 2018-11-26 11:33:23 +01:00
Armin Novak
09b9d4f199 Fixed CVE-2018-8787
Thanks to Eyal Itkin from Check Point Software Technologies.
2018-11-20 11:08:31 +01:00
Armin Novak
3e2caa88a4 Fixed invalid NULL check 2018-11-20 09:38:02 +01:00
Armin Novak
53fdea8455 Clip coordinates for lineTo and polyLine 2018-11-19 17:25:19 +01:00
Armin Novak
d75c464dbd Fixed signed/unsigned warnings. 2018-11-19 17:25:19 +01:00
Armin Novak
75d532f87c Fixed glyph cache bounds setting. 2018-11-19 13:58:53 +01:00
Armin Novak
e94ed7d762 Fixed gdi_BitBlt coordinate clipping. 2018-11-19 12:55:50 +01:00
Armin Novak
a078d8714e Fixed opaque rect bounding rectangle. 2018-11-19 12:55:50 +01:00
akallabeth
b6eca4fc54 signed gdi regions to adjust negative coordinates 2018-11-19 12:52:43 +01:00
Armin Novak
88d310ff2c Fixed compiler warnings (casts, ...) 2018-10-18 09:09:30 +02:00
Armin Novak
a432a297ca Fixed division by 0 if invalid formats are used. 2018-10-17 11:37:51 +02:00
Armin Novak
c0d38778f1 Fixed length sanity check. 2018-10-17 10:09:37 +02:00
Armin Novak
777bfe5c40 Fixed const correctness of arguments. 2018-10-16 17:29:10 +02:00
Armin Novak
75517c06fb Added parameter checks. 2018-10-16 17:26:57 +02:00
Armin Novak
3629a84d3f Fixed missing input validation. 2018-10-16 17:10:03 +02:00
Armin Novak
5ea4a7d3b0 Proper order checks. 2018-10-16 15:56:17 +02:00
Armin Novak
7d8e6377df Fixed a memory leak in cleaning up brushes. 2018-10-16 09:31:30 +02:00
Armin Novak
1d77875a69 Fix NULL function pointer BeginPaint 2018-09-24 12:47:46 +02:00
Armin Novak
13e59b5d6a Fix #4868: Allow empty bands data. 2018-09-19 14:18:29 +02:00
Armin Novak
6d3beabd54 Removed unused variables in tests. 2018-08-24 13:40:36 +02:00
Armin Novak
1f7d33a2f2 Fixed read/write of surface bits command.
The optional field exBitmapDataHeader of TS_ BITMAP_DATA_EX was ignored.
Read and expose the data (currently unused)
2018-03-01 11:38:59 +01:00
Armin Novak
1a902c249c Fix PROFILER_* macros
Add the semicolon to the macro to allow clean
undefinition if the profiler is not used.
This used to break VisualC compilers.
2018-02-15 11:30:38 +01:00
Armin Novak
990b8c23a9 Fixed PubSub function pointer casts. 2018-02-14 11:00:52 +01:00
David Fort
441975a4aa video, geometry: fix prototypes for timer callbacks 2018-02-14 10:16:38 +01:00
David Fort
484abe0567 video: fix invalid geometry and invalid argument passing to time pubsub 2018-02-14 00:08:52 +01:00
Armin Novak
d9277b7fb8 Fixed copy offset issue. 2018-02-13 10:52:53 +01:00
Armin Novak
c7d701bdf8 Added software decoding fallback for RDPVOR 2018-02-13 10:52:53 +01:00
Armin Novak
2cf10cc359 bitmap free now always deallocating all resources. 2018-02-13 10:18:43 +01:00
Armin Novak
c0ec81c3c7 Do not update client if output suppressed. 2018-02-08 11:59:00 +01:00
Armin Novak
253beda330 Fixed formatting. 2018-02-08 11:55:57 +01:00
David Fort
ab94f6a5fd
Merge pull request #4339 from akallabeth/gdi_sw_crash_fix
Fixed #4336: Initialize rectangle.
2018-01-10 09:57:54 +01:00
Armin Novak
5140ee09b3 Reduced log priority in gdi_CRgnToRect 2018-01-08 13:03:06 +01:00
David Fort
e1cc601963
Merge pull request #4323 from akallabeth/scanbuild_fixes
Scanbuild and other warnings fixed
2018-01-08 11:16:21 +01:00
Armin Novak
bcf3babcaa Fixed #4336: Initialize rectangle. 2018-01-08 09:01:22 +01:00
Armin Novak
cf899eb5ba Fix #4299: gdi_CRgnToRect
The coordinates from RDP ROP commands do not (always) have
0,0 as the origin of the drawing operation.
Adjust the coordinates to our local coordinate system.
2017-12-22 13:43:37 +01:00
Armin Novak
b293b17ac9 Added ROP to string functions for log messages. 2017-12-22 10:25:05 +01:00
Armin Novak
9c93c6cbf3 Fixed unused variable warnings. 2017-12-21 11:04:50 +01:00
Martin Fleisz
bfe8359b5b
Merge pull request #4239 from akallabeth/test_memleak_fixes
Test memleak fixes
2017-12-20 12:38:38 +01:00
Martin Fleisz
5cec90c781
Merge pull request #4305 from hardening/xrandr_fix
Fix XRandr for old systems and MacOSX
2017-12-13 17:24:41 +01:00
Armin Novak
2f35c4b158 Fixed remaining color renaming issues. 2017-12-12 11:41:43 +01:00
Armin Novak
ae2a96293b Cleanup and initialization checks. 2017-12-12 11:40:48 +01:00
Armin Novak
7305828122 Fix #4239: Various memory leaks
* Fixed all tests, now can be run with -DWITH_ADDRESS_SANITIZER=ON compiled.
* Enabled address sanitizer for nightly builds.
2017-12-12 11:40:48 +01:00
David Fort
3b670703fb
Merge pull request #4277 from akallabeth/mac_server
Mac fixes
2017-12-12 10:40:14 +01:00
David Fort
11ee81be60 Fix XRandr for old systems and MacOSX
We need a recent enough version of XRandr to correctly detect monitor.
Also this patch adds some typo or style fixes.
2017-12-08 10:59:38 +01:00
daixj
d10448fde2 Fix #4291: xfreerdp segfault when connecting freerdp-shadow-cli 2017-11-29 05:12:40 -05:00
Armin Novak
57958cb178 Fixed #3810: Renamed color functions 2017-11-24 13:21:43 +01:00
Armin Novak
24233b299c Fix #4111: 15bpp color handling for brush. 2017-11-20 15:00:09 +01:00
Armin Novak
ceda3d3f4a Fixed color for drawing rectangles. 2017-11-15 15:56:25 +01:00
David Fort
5d5376faa7 egfx: fix disconnection caused by invalid cache entries due to wrong announced cache size
Added some checks so that when setting a cache entry fails, we close connection (or
we fail later when trying to use that empty entry).
The small cache egfx capability has also been fixed.
2017-10-10 17:12:16 +02:00
Armin Novak
d3df6ed40f Removed unused variable. 2017-08-31 09:57:49 +02:00
Armin Novak
8b9e3fa51e Fixed use of reserved keywords for include guards. 2017-07-20 09:35:41 +02:00
Armin Novak
0490aeb018 Fixed clang malloc integer overflow warnings. 2017-07-20 09:29:48 +02:00
Armin Novak
96d53933d2 Deactivated all H264 related code paths. 2017-07-17 10:39:08 +02:00
Armin Novak
3eb882dd53 Check arguments for Bitmap_SetSurface
The function may be called during connection phase
where there is no valid GDI available.
2017-05-11 13:34:37 +02:00
Armin Novak
21e20ac9f2 Initialize H264 context size for GFX surfaces. 2017-05-10 12:36:08 +02:00
akallabeth
8df8cc6fb5 Merge pull request #3937 from hardening/h264_multimon
Fix h264 in multimon scenario
2017-05-09 11:16:12 +02:00
Armin Novak
80f6fcf38c Added missing callbacks. 2017-05-03 09:30:22 +02:00
Armin Novak
614d5f0a8e Fixed use after free of region. 2017-05-03 08:48:36 +02:00
Armin Novak
f3e0c95d45 Added a GFX area update callback. 2017-05-03 08:48:03 +02:00
David Fort
d170c10ee6 Fix H264 in multi monitor case
The H264 context is surface specific, so in multi-monitor (with multiple surfaces)
the decoding was failing. This patch fixes that by introducing a surface specific
h264 context.
2017-05-02 18:39:33 +02:00
Armin Novak
b0d3cfda4d Added AVC444v2 client support. 2017-04-11 11:29:14 +02:00
Norbert Federa
1739f27b82 rdpegfx: fix RemoteFX Progressive Codec decoding
Since this comes via a Wire-To-Surface-2 PDU we don't have
any left/top/right/bottom destination values.
The current code has always dealt with zeros when updating the
invalid region which resulted in black rectangles.
The correct update region is determined during decompression.
2017-04-03 18:59:58 +02:00
Armin Novak
8d116e6ee9 Use exclusive coordinates in CacheToSurface. 2017-03-31 12:06:21 +02:00
Norbert Federa
0bb67a0a69 improve rdpegfx drawing for software gdi
process the region's rectangles individually instead of
just copying the extents
2017-03-30 15:42:13 +02:00
Armin Novak
09d43a66f4 Fixed tests and dead store warnings. 2017-03-28 16:49:56 +02:00
Norbert Federa
fa2086686b some performance fixes
- draw only the updated region in the gdi and x11 surface bits implementation
- don't repeatedly call IsProcessorFeaturePresentEx in rfx rlgr decoder
- fix ugly and unaligned profiler print layout and remove an unnecessary value
2017-03-27 20:14:13 +02:00
Armin Novak
c249705085 Fixed scanbuild warnings. 2017-02-20 13:45:19 +01:00
David Fort
be41769506 Add some useful debug info for the egfx channel 2017-02-16 14:49:08 +01:00
Armin Novak
6960ca209b Added GFX surface command profiler. 2017-02-15 15:42:14 +01:00
Armin Novak
d41d65575c Use bitmap color format in gdi_BitBlt 2017-02-14 16:02:12 +01:00
Armin Novak
f324b0ef9c Use aligned malloc/free for GFX surfaces/buffers 2017-02-14 16:02:11 +01:00
Martin Fleisz
5930d7e81b gdi: Allow changing buffer even if size remains the same 2017-02-14 09:52:44 +01:00
Armin Novak
8845b3ffa2 Added warning for unsupported color depth. 2017-02-06 10:31:43 +01:00
Armin Novak
df764f5aad Fixed GDI color decoding issues. 2017-02-01 11:02:23 +01:00
Martin Fleisz
99c9195218 Merge pull request #3694 from akallabeth/avc420_black_artifact_fix
Fixed solid fill command.
2017-01-13 09:24:52 +01:00
Armin Novak
8f58e7fc06 Initializing gdi.stride on resize. 2017-01-11 15:31:48 +01:00
Armin Novak
936e5a05dc Fixed solid fill command.
If the alpha channel must be ignored in this command.
2017-01-11 13:25:44 +01:00
Armin Novak
08606323d6 Fixed software GDI line to pen color. 2017-01-09 16:35:34 +01:00
Norbert Federa
f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Armin Novak
514a33d435 Respecting color depth with RDP_CODEC_ID_NONE. 2016-12-07 13:22:52 +01:00
Armin Novak
d4b823d5cb Using a single codec context per session. 2016-12-07 13:22:00 +01:00
Martin Fleisz
e059e3dea3 codec: Remove src format parameter from rfx_process_message
This parameter is not required. Default param is BGRX32
and if an other format is required rfx_codec_set_pixel_format
can be used.
2016-12-01 17:21:06 +01:00
Armin Novak
d1e2dd3281 Moved format size calculation out of loop. 2016-11-24 10:01:45 +01:00
Martin Fleisz
06d47530b6 Merge pull request #3594 from akallabeth/line_draw_color_format
Fixed line drawing color format #3592
2016-11-18 12:46:14 +01:00
Armin Novak
1203315b50 Fixed line drawing color format #3592 2016-11-14 09:37:15 +01:00
Armin Novak
95a3144b34 Scanline alignment for GFX cache. 2016-10-31 07:56:10 +01:00
Armin Novak
f62d00445e Fixed surface alignment. 2016-10-28 11:54:34 +02:00
Martin Fleisz
f2abcaabc0 Merge pull request #3554 from akallabeth/color_refactor
Replaced _VF formats with copy flags.
2016-10-19 13:31:54 +02:00
Armin Novak
30b5b01cf1 Fixed invalid arguments for gdi_resize_ex 2016-10-18 15:16:58 +02:00
Armin Novak
9c50e1a635 Replaced _VF formats with copy flags. 2016-10-14 10:36:52 +02:00
Armin Novak
ae5689709c Fixed uninitialized variables. 2016-10-13 16:57:51 +02:00
Bernhard Miklautz
5a5f091b7c Merge pull request #3545 from akallabeth/legacy_rfx_fixes
Fixed Windows 7 RFX issues.
2016-10-13 13:01:53 +02:00
Armin Novak
714e704352 Color format for surface bits unified. 2016-10-12 09:32:59 +02:00
Armin Novak
8286fa4b96 Fixed format flip and offsets for GDI. 2016-10-11 18:50:01 +02:00
Armin Novak
c3058ba580 Optimized ROP for GDI_SRCCOPY and GDI_DSTCOPY. 2016-10-11 14:47:26 +02:00
Armin Novak
c2787d7c5f Optimized gdi_FillRect 2016-10-11 14:47:26 +02:00
Armin Novak
c405e1515e Inlined heavily used function. 2016-10-11 14:47:26 +02:00
Armin Novak
94c6473250 Inlined heavily used functions. 2016-10-11 14:47:26 +02:00
Armin Novak
404ae7d83c Fixed Windows 7 RFX issues. 2016-10-11 14:34:07 +02:00
Martin Fleisz
9afc0cca26 Merge pull request #3536 from akallabeth/memory_leak_fixes
Memory leak fixes
2016-10-11 09:29:49 +02:00
zihao.jiang
34b4bca119 Fix nsc client after after color conversion huge fix
nsc codec client doesn't work:
1. We should mark invalid region for software gdi
2. Checked the code before color conversion fix, the correct color format should be PIXEL_FORMAT_BGRX32_VF (corresponds to old PIXEL_FORMAT_XRGB32_VF)
3. For gdi:hw: xfc->bitmap_buffer is never used/initialized. However gdi->primary_buffer is always maintained. So use primary_buffer to hold the decoded bitmap data
2016-10-11 02:18:31 +08:00
Armin Novak
eecc4b189f Fixed leak in bitmap handling. 2016-10-10 10:42:14 +02:00