Commit Graph

484 Commits

Author SHA1 Message Date
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
zihao.jiang
a6311d29e7 Add ascii art for norbert_test_case 2015-03-21 01:07:54 +08:00
zihao.jiang
2a91988975 resolve comments from hardening 2015-03-21 00:04:30 +08:00
zihao.jiang
ce06229499 fix tab/space style 2015-03-20 23:40:48 +08:00
zihao.jiang
f94935224c Fixes extents of region16_intersect_rect.
See Issue #2443.
When there's more than 2 rectangles in the region structure, region16_intersect_rect would calculate extents by all 'intersected' sub rectangles.
But it always extend the extents to (0,0) because it initialize the new extents as (0,0,0,0) and union later rectangles with this empty point by simple MIN/MAX calculation.

Also fixed rectangle_is_empty although it has not been used yet. The function does not work as its name.
Reuse norbert case. That case is enough for the intersect fix, but the expected result is not correct. The test case is also fixed.
Added test case to check empty rectangle.
2015-03-20 20:55:06 +08:00
Marc-André Moreau
0e94ac663d libfreerdp-codec: add support for 16 color palette image copy 2015-03-16 14:01:43 -04:00
Marc-André Moreau
9562439bd8 libfreerdp-codec: add support for 1bpp image copy 2015-03-16 13:27:27 -04:00
Marc-André Moreau
ad02c75af8 libfreerdp-gdi: disable broken BitBlt tests 2015-03-16 08:55:06 -04:00
Zhang Zhaolong
f0adff1812 codec: check return value of realloc.
Signed-off-by: Zhang Zhaolong <zhangzl2013@126.com>
2015-03-11 14:18:45 +08:00
Vic Lee
3c3c7068a0 Add openh264 encoder support. 2015-03-02 18:11:28 +08:00
Marc-André Moreau
0054b6b134 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2015-02-06 18:02:10 -05:00
Marc-André Moreau
fdde017526 libfreerdp-codec: allow region_uninit to be called multiple times 2015-02-05 15:10:24 -05:00
Petr Sumbera
8510373b04 Fixes Solaris bus error on sparc. 2015-02-05 08:46:56 -08:00
Armin Novak
d42261f5eb Added destination buffer width to h264_decompress.
Added proper region limit checks in h264_decompress.
2015-01-22 13:22:53 +01:00
Armin Novak
c43faeec0a Removed broken buffer size check.
To check the decoded h264 frame size against the output buffer is wrong.
The size of the output buffer must only hold the data defined by the
region rectangles.
2015-01-22 13:06:37 +01:00
Armin Novak
a217e02924 Prettiefied WLog messages. 2015-01-20 11:10:16 +01:00
Armin Novak
a295a42664 Prettiefied WLog messages. 2015-01-20 11:10:03 +01:00
Armin Novak
595680d169 Prettiefied WLog messages. 2015-01-20 11:09:54 +01:00
Armin Novak
528c5841d5 Fixed memory leak. 2014-12-07 00:50:20 +01:00
Marc-André Moreau
88dd5eb8c5 Merge pull request #2225 from akallabeth/openh264_fix
Openh264 v1.2 API
2014-11-28 11:23:11 -05:00
Marc-André Moreau
8a7a71a7b6 Merge pull request #2213 from akallabeth/wlog_callback_appender
Wlog callback appender
2014-11-17 09:41:58 -05:00
Armin Novak
83477e5344 Fixed memory leak. 2014-11-17 01:10:45 +01:00
Armin Novak
e4b33efdb2 Fixed memory leak. 2014-11-17 00:56:56 +01:00
Armin Novak
dac7c178a1 Fixed memory leak. 2014-11-17 00:44:22 +01:00
Armin Novak
a9cfb1d07b Fixed memory leak. 2014-11-17 00:37:29 +01:00
Armin Novak
3a92a626fc Fixed memory leaks. 2014-11-16 23:11:28 +01:00
Armin Novak
ce3e70840c Fixed uninitialized value. 2014-11-16 22:22:44 +01:00
Armin Novak
b5d7c30639 Added support for OpenH264v1.2 2014-11-16 14:32:52 +01:00
Armin Novak
8d4589b1e1 Replaced fprintf error messages with WLog. 2014-11-16 12:21:38 +01:00
Norbert Federa
7c0c905683 libfreerdp-codec: fix mppc decompression
* protect against history buffer overflows
* fix replicating copy (CopyOffset can be > HistoryBufferSize!)
2014-11-13 14:55:15 +01:00
Norbert Federa
ea0d8a280c codec: fix pointer data conversion + 24bpp support
- alpha values were annihilated (fixed)
- support 24bit xor mask data added
2014-10-31 12:18:08 +01:00
Marc-André Moreau
765150e3ed libfreerdp-codec: fix incorrect pixel increment in freerdp_image24_copy 2014-10-23 15:50:24 -04:00
Marc-André Moreau
5f95f0776f libfreerdp-codec: add freerdp_image_copy_from_monochrome replacement function for deprecated freerdp_mono_image_convert 2014-10-21 21:56:10 -04:00
Marc-André Moreau
0aab1e7ee5 libfreerdp-codec: fix and enhance cursor image conversion 2014-10-21 20:46:15 -04:00
Marc-André Moreau
26556323c0 libfreerdp-color: fix 24bpp copy 2014-10-14 20:59:22 -04:00