Commit Graph

518 Commits

Author SHA1 Message Date
David FORT ff92a12ceb Fix a bug in region_union_rect()
When region_union_rect() was called with a rect that was above the region without
intersecting it, the first band was created too large. This patch fixes this and
add a unitary test.

All credits go to @nfedera that:
* found the bug;
* find a dataset to reproduce;
* code the unitary test;
* spotted a suspicious line that was the faulty one.
2015-09-30 21:14:43 +02:00
MartinHaimberger d4d360f6a4 Merge pull request #2859 from akallabeth/resource_leak_fix
Fixes API misuse and logic errors
2015-09-15 14:45:42 +02:00
Norbert Federa 1791d42a5d improve handling of inverted pointer colors 2015-09-03 16:50:41 +02:00
MartinHaimberger 74817efbdb Merge pull request #2852 from bmiklautz/process_env
Update CreateProcess and rfx
2015-09-02 10:09:11 +02:00
Armin Novak 08f61e60ca Fixed zero length allocation. 2015-09-01 12:25:44 +02:00
Norbert Federa 2d5e249eff Merge pull request #2825 from akallabeth/pointer_decoding_fix
Fixed color pointer decoding.
2015-09-01 11:09:42 +02:00
Armin Novak 89227b97f0 Ignore AND mask for 32 bit pointer. 2015-09-01 10:53:45 +02:00
Bernhard Miklautz c0d1f5bac1 codec/rfx: update comment and remove WLog_ERR
With revision 17.0 of [MS-RDPRFX] the behavior when numRects == 0 is
documented.
This commit updates the comment and removes the error logging.
2015-08-28 10:36:56 +02:00
Armin Novak 4ed701bf35 media foundation support now a compile time option. 2015-08-11 07:58:43 +02:00
Armin Novak 4a62e6bee4 Added length arguments and checks. 2015-08-06 11:24:42 +02:00
Armin Novak 4df5e2b998 Fixed argument checks. 2015-08-05 17:32:38 +02:00
Armin Novak 0cbc46dc34 Fixed pointer update decoding with NULL mask. 2015-08-05 17:21:10 +02:00
Marc-André Moreau 162411dc67 libfreerdp-codec: fix Windows XP build for H.264 decoder 2015-08-04 11:55:03 -04:00
Marc-André Moreau 8fb9535e4a libfreerdp-codec: fix leaks in H.264 Media Foundation decoder 2015-08-04 10:26:13 -04:00
Marc-André Moreau d952502285 libfreerdp-codec: initial Media Foundation H.264 decoder support 2015-08-03 16:21:48 -04:00
Marc-André Moreau 32d1053abe libfreerdp-codec: add more Media Foundation H.264 code 2015-07-30 14:07:35 -04:00
Marc-André Moreau 4dc47d4867 libfreerdp-codec: start H.264 MediaFoundation support 2015-07-29 16:33:04 -04:00
Marc-André Moreau 9400ccb4bc libfreerdp-codec: add x264 stubs 2015-07-28 16:01:34 -04:00
Marc-André Moreau a8e62e938a libfreerdp-codec: fix egfx artifacts resulting from incorrect handling of rects inside the same egfx frame 2015-06-28 13:57:46 -04:00
Marc-André Moreau 5ec19d2045 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2015-06-26 14:00:03 -04:00
Marc-André Moreau 24ed6b06cc channels/rdpgfx: update debug output 2015-06-26 13:59:41 -04:00
Norbert Federa ac95b7274e Merge pull request #2727 from akallabeth/leak_fixes_reformat
Fixed leaks, NULL dereferences and broken init.
2015-06-26 15:01:08 +02:00
Armin Novak e8bfa29bd2 Replaced registry keys with cmake defines. 2015-06-24 14:02:48 +02:00
Armin Novak a809b87362 Fixed memory leak. 2015-06-24 10:02:42 +02:00
Armin Novak 2ff1205dde Fixed a resource leak. 2015-06-24 09:45:40 +02:00
Armin Novak 2e762c881c Fixed a resource leak. 2015-06-24 09:33:20 +02:00
Armin Novak 6698e24228 Fixed leaks, NULL dereferences and broken init. 2015-06-23 21:29:21 +02:00
David FORT 7c3f8f33ab Fixes for malloc / calloc + other fixes
This patch contains:

* checks for malloc return value + treat callers;
* modified malloc() + ZeroMemory() to calloc();
* misc fixes of micro errors seen during the code audit:
** some invalid checks in gcc.c, also there were some possible
integer overflow. This is interesting because at the end the data are parsed
and freed directly, so it's a vulnerability in some kind of dead code (at least
useless);
** fixed usage of GetComputerNameExA with just one call, when 2 were used
in misc places. According to MSDN GetComputerNameA() is supposed to return
an error when called with NULL;
** there were a bug in the command line parsing of shadow;
** in freerdp_dynamic_channel_collection_add() the size of array was multiplied
by 4 instead of 2 on resize
2015-06-22 19:21:47 +02:00
Bernhard Miklautz bf73f4e4f1 Fix unchecked strdups
* add missing checks
* adapt function return values where necessary
* add initial test for settings
2015-06-22 19:09:59 +02:00
Norbert Federa 20aa10e6ae codec/color: support for 8bpp color pointer 2015-06-11 16:34:42 +02:00
Norbert Federa 86d398f0a3 codec/color: support for 16bpp color pointer 2015-06-11 13:12:21 +02:00
Vic Lee 1d31f25992 h264: add encoder constant QP rate control. 2015-06-02 15:32:45 +08:00
Martin Haimberger 951a2d2210 stream: check stream_new in winpr and libfreerdp
also fixed a few things
2015-05-29 04:46:50 -07:00
Bernhard Miklautz f9c7e03044 winpr: add intrin.h
Exposing lzcnt in crt.h might causes compiler errors (redefinition) with
recent versions of gcc (>=4.9) when winpr is included in other projects.
As lzcnt isn't part of crt according to MSDN and also shouldn't be
exported by default it was moved to intrin.h.

The related test was also moved to the top level directory of winpr.
2015-05-26 16:41:29 +02:00
Norbert Federa 535a4352a7 shadow/client context cleanup and unused vars fix 2015-05-21 16:05:05 +02:00
Norbert Federa cd0a8e0506 Merge pull request #2630 from hardening/new_2616
Add checks for some XXX_New and XXX_Add functions
2015-05-21 16:04:26 +02:00
Clive Stevens 63ecb59681 Fix rounding error in progressive codec
The grid is composed of 64x64 blocks and should not be smaller
than the surface. If width or height were not a multiple of 64
the previous rounding resulted in a grid smaller than the surface.
2015-05-20 12:26:58 +01:00
Hardening f8120919af Add checks for some XXX_New and XXX_Add functions
Based on PR #2616
2015-05-18 11:28:00 +02:00
Norbert Federa 1eff1a345e free can handle NULL perfectly fine 2015-05-11 09:07:39 +02:00
Norbert Federa 25fc866a58 Fix unchecked CreateThread calls and misc fixes 2015-05-05 13:55:48 +02:00
Norbert Federa ef1fd12b15 Fix unchecked CreateEvent calls and misc fixes
1)
Added missing checks for CreateEvent which also required the
following related changes:

- changed freerdp_context_new API to BOOL
- changed freerdp_peer_context_new API to BOOL
- changed pRdpClientNew callback to BOOL
- changed pContextNew callback to BOOL
- changed psPeerAccepted callback to BOOL
- changed psPeerContextNew callback to BOOL

2)
Fixed lots of missing alloc and error checks in the
changed code's neighbourhood.

3)
Check freerdp_client_codecs_prepare result to avoid segfaults
caused by using non-initialized codecs.

4)
Fixed deadlocks in x11 caused by missing xf_unlock_x11() calls
in some error handlers

5)
Some fixes in thread pool:
- DEFAULT_POOL assignment did not match TP_POOL definition
- don't free the pool pointer if it points to the static DEFAULT_POOL
- added error handling and cleanup in InitializeThreadpool
2015-04-29 18:18:39 +02:00
Norbert Federa 5926bbcf48 codec/rfx: simplification, segfault/malloc fixes
rfx_process_message_sync:
- simplified the check if the header messages got processed

rfx_process_message_tileset:
- ObjectPool_Take result was not checked
- fail if TS_RFX_TILE block type is not CBT_TILE
- CreateThreadpoolWork result was not checked
- post decoding loop code segfaulted in error case

rfx_decoder_tile_new:
- missing malloc check

rfx_message_free:
- segfault protection

rfx_write_message_tileset:
- segfault protection
2015-04-24 17:54:49 +02:00
Norbert Federa 84577b1ca7 codec/rfx: error checking and various fixes
- removed some unneeded null checks for free()
- fixed a memory leak in shadow_client
- removed rfx_compose_message_header from API

Changed the following functions to BOOL, check the result
where they are called and handle failures:
- rfx_compose_message
- rfx_compose_message_header
- rfx_write_tile
- rfx_write_message_tileset
- rfx_write_message_frame_begin
- rfx_write_message_region
- rfx_write_message_frame_end
- rfx_write_message

rfx_process_message:
- check memory allocation failures
- verify protocol-conform order of data messages to prevents memory
  leaks caused by repeated allocations
- verify that header messages were parsed/received before the
  data messages
- treat unknown rlgr mode as error
- fixed/added error handling
- fixed all callers to check/handle result

rfx_encode_message:
- fixed incorrect usage of realloc
- missing malloc check
- missing check of CreateThreadpoolWork
- correct cleanup on failure (threadpool, memory)
- check rfx_encode_message result

rfx_encode_messages:
- check rfx_split_message result
- correct cleanup on failure
- prevent memory leak on failure

rfx_write_message_context:
- fixed invalid channelId value (must be 0xFF for WBT_CONTEXT)

rfx_process_message_codec_versions:
- fixed invalid read size of codec_version (it is 16bit)

rfx_process_message_channels:
- verify protocol conform channelId value

rfx_process_message_region:
- replaced invalid reallocs with malloc
- read and verify regionType and numTileSets from stream

rfx_process_message_tileset:
- check allocation results
- fixed incorrect usages of realloc

setupWorkers:
- fixed incorrect usages of realloc

rfx_split_message:
- removed dead code
- missing malloc check

rfx_compose_message:
- fixed a memory leak
- check/handle rfx_encode_message result
2015-04-23 15:42:21 +02:00
Bernhard Miklautz 515502ffa5 change return types of callbacks to BOOL
* change all client/server callbacks to BOOL
* update all clients accordingly
* add multiple return value checks
* small fixes
2015-04-21 14:18:07 +02:00
Vic Lee 93d59ac3de h264: change encoder api and add multi-thread support. 2015-04-21 14:02:57 +08:00
Bernhard Miklautz 850de59b55 winpr: add checks for *alloc
Add missing checks if memory allocation was successful. Also adapt
caller(s) when possible.
2015-04-08 11:34:37 +02:00
Bernhard Miklautz 74c8400789 coding style fixes
Add missing space after if
2015-03-30 17:15:45 +02:00
Bernhard Miklautz f469e069dc stream: Stream_Ensure*Capacity: change return type
Change the return type of Stream_Ensure*Capacity from void to BOOL to be
able to detect realloc problems easily. Otherwise the only way to detect
this was to check if the capacity after the call was >= the required
size.
In case Stream_Ensure*Capacity fails the old memory is still available
and need to freed outside.

This commit also adds checks to most calls of Stream_Ensure*Capacity to
check if the call was successful.
2015-03-30 16:33:48 +02:00
Bernhard Miklautz 3c7662517c hardening
Start to add missing checks for:
* *alloc
* *_New
2015-03-25 17:38:21 +01:00
Hardening 20433e6f29 Merge pull request #2443 from realjiangms/fix_region
Incorrect extents calculation in region16_intersect_rect (libfreerdp/codec/region.c)
2015-03-20 22:12:48 +01:00