Commit Graph

1294 Commits

Author SHA1 Message Date
akallabeth
1208f23bc9 [codec,clear] fix integer overflow
reorder check to prevent possible integer overflow
2024-04-16 11:25:27 +02:00
akallabeth
d58cbc96ac [codec,nsc] fix missing check
in nsc_rle_decode abort if there are more bytes to be read then there
are left.
2024-04-16 11:25:27 +02:00
Armin Novak
aa3d05f4f2 [coverity] 1543233 Unintended sign extension 2024-04-15 11:30:31 +02:00
akallabeth
70eec6c18e [coverity] 1543279 Out-of-bounds read 2024-04-12 09:45:09 +02:00
akallabeth
6241ce5674 [coverity] 1543052 Out-of-bounds read 2024-04-12 09:45:09 +02:00
akallabeth
bcf189b6b3 [codec,rfx] explicitly cast return
cast to avoid compilation issues with incompatible-pointer-types
2024-03-18 13:27:32 +01:00
akallabeth
9a7d30d174 [clang,tidy] fix a few warnings 2024-02-27 14:15:43 +01:00
akallabeth
acedd305d3 fixed unused-but-set-variable warnings 2024-02-22 12:31:50 +01:00
akallabeth
05e555feb7 fixed unused-variable warnings 2024-02-22 12:31:50 +01:00
akallabeth
43eae6029f [clang-tidy] fix various review warnings 2024-02-22 12:31:50 +01:00
akallabeth
d7ebec5a65 [tidy] move loop variable declaration to loop 2024-02-22 12:31:50 +01:00
akallabeth
0e44b2c674 [clang-tidy] clang-analyzer-unix.Malloc 2024-02-15 11:49:16 +01:00
akallabeth
81d2c1f057 [clang-tidy] clang-analyzer-core.NullDereference 2024-02-15 11:49:16 +01:00
akallabeth
f69e1fe697 [clang-tidy] readability-duplicate-include 2024-02-15 11:49:16 +01:00
akallabeth
0ba995655d [clang-tidy] cppcoreguidelines-init-variables 2024-02-15 11:49:16 +01:00
akallabeth
207def5c56 [clang-tidy] readability-isolate-declaration 2024-02-15 11:49:16 +01:00
akallabeth
db8682648b Revert "[codec] encode messages considering endianness"
This reverts commit 6ba4aad9ab.
2024-02-09 10:29:08 +01:00
akallabeth
9a51830434 [codec,jpeg] use winpr image for jpeg 2024-02-07 10:04:08 +01:00
akallabeth
ba8cf8cf21 [build] fix Wmismatched-deallocator warnings
With custom malloc function attributes the fail path in the _New
functions produces warnings due to allocator mismatches. Silence them.
2024-02-05 08:16:55 +01:00
akallabeth
bb42d425ed [gcc,clang] add support for attribute(malloc)
Mark all malloc like functions and add their appropriate free function
to let the compiler complain on mismatches
2024-02-02 15:10:40 +01:00
Armin Novak
939e922936 [codec,planar] check resolution for overflow
If the codec resolution is too large return an error as the internal
buffers would otherwise overflow.
2024-01-16 09:02:58 +01:00
Armin Novak
f9a4bd44ba [codec,test] better error logging for progressive 2023-12-20 09:03:58 +01:00
Armin Novak
3043fca91d [warnings] fixed -Wdiscarded-qualifiers 2023-12-13 13:24:22 +01:00
Armin Novak
cce3253fdf [warnings] fixed -Wincompatible-pointer-types 2023-12-13 13:24:22 +01:00
akallabeth
1b31852d32 [git] remove .gitignore
we do no longer allow in source builds, so remove all the .gitignore
files just hiding generated files
2023-11-28 12:14:55 +01:00
Armin Novak
1ef7b9e3e0 [codec,dsp] fix ffmpeg deprecation warning 2023-11-24 21:23:38 +01:00
akallabeth
5dd12c5b1b [codec,dsp] mark fallthrough 2023-11-24 18:19:03 +01:00
akallabeth
dd2d110870 [warnings] fix -Wcast-qual 2023-11-24 18:19:03 +01:00
akallabeth
ceb7bd1d41 [warnings] fixed clang build warnings 2023-11-24 18:19:03 +01:00
Armin Novak
593e2bf4a9 [api] fix compiler warnings
check #if defined(__GNUC__)
2023-11-24 14:54:56 +01:00
akallabeth
cd4d77af86 [settings] add deprecation warnings
direct struct access to rdpSettings now produces warnings if not
explicitly deactiaved by defining FREERDP_SETTINGS_INTERNAL_USE
2023-11-24 14:54:56 +01:00
akallabeth
1163cc4d5c [core] add internal settings.h include 2023-11-24 14:54:56 +01:00
Pascal Nowack
9c3dfefb7f codec/dsp: Also set bitrate for Opus encoder 2023-11-21 14:29:47 +01:00
akallabeth
26e003ce05 [codec,dsp] experimental opus encoder 2023-11-21 14:29:47 +01:00
akallabeth
c2c40ae2ff [codec,dsp] initial support for ffmpeg/opus 2023-11-21 14:29:47 +01:00
akallabeth
7a05d85a7f [codec,dsp] unify opus sample rate check 2023-11-21 14:29:47 +01:00
akallabeth
a232cec690 [codec,dsp] fix opus related code
* proper library detection
* default to NOT WITH_DSP_FFMPEG
* disable if WITH_DSP_FFMPEG
2023-11-21 14:29:47 +01:00
Pascal Nowack
330f7ae0a2 codec/dsp: Add support for decoding Opus encoded streams
The Opus codec is a modern free audio codec, that is also royalty-free.
Adding support for it will allow clients and servers supporting it to
transfer audio in similar efficient way like with AAC.
So, add support it.
2023-11-21 14:29:47 +01:00
akallabeth
20f09b2d34 [codec,aac] add NaN filter
ffmpeg format conversion from int16 to float sometimes produces values
that are NaN or Infinity.
Replace these values as these input values break the AAC encoder
2023-11-20 14:22:26 +01:00
Armin Novak
60390ea40c [pragma] unify compiler diagnostics 2023-10-16 15:10:13 +02:00
Armin Novak
07543a6042 [warnings] fix various warnings
* missing const in casts
* missing static for functions
* missing WINPR_ATTR_FORMAT_ARG for printf like functions
2023-10-16 15:10:13 +02:00
Armin Novak
4778203340 [restrict] remove from in/out buffers 2023-10-16 15:10:13 +02:00
Armin Novak
fe28f9ed9c [keyword,restrict] do not use for shift operations
shifting operations are done on a in/out buffer, so the restrict keyword
is not appropriate for that.
2023-10-16 15:10:13 +02:00
akallabeth
8be124b4a2 [codec,rfx] revert removal of rfx_message_get_frame_idx 2023-10-10 19:35:27 +02:00
akallabeth
a41360e3b0 [codec,rfx] added missing RFX encoder API calls 2023-10-07 21:26:27 +02:00
akallabeth
0b7b8445bc [codec,ncrush] fix const correctness of pointer 2023-09-21 10:57:43 +02:00
Armin Novak
79da16244e [codec,progressive] fix overlapping buffers 2023-09-15 11:24:21 +02:00
akallabeth
7a17671cc9 [codec,h264] first update sizes before checking 2023-09-11 12:53:35 +02:00
akallabeth
d93c4fea2c [codec,interleaved] fix compiler warning 2023-09-11 12:53:35 +02:00
Armin Novak
730c621699 [codec,interleaved] fix type definition 2023-09-08 14:44:22 +02:00
akallabeth
9a9db5b7f3 [codec,progressive] expose progressive simple
server implementations might require serializing messages to a simple
tile, so expose this function.
2023-09-05 11:40:09 +02:00
Armin Novak
d6f9d33a7d [codec,planar] fix reset 2023-08-30 11:12:09 +02:00
akallabeth
ab31e8ba6a [codec,h264] ensure context buffer update
if realloc is called with 0 size update the pointers and do not fail
2023-08-30 11:11:58 +02:00
akallabeth
17d64237ef [codec,yuv] check rectangles for validity
the decoder needs to check bounds for supplied rectangles for both,
input and output buffers.
2023-08-28 14:26:10 +02:00
Armin Novak
16141a30f9 [codec,ncrush] fix index checks
properly verify all offsets while decoding data.
2023-08-28 13:35:45 +02:00
Armin Novak
031c8bacfa [codec,zgfx] fix cBitsRemaining calculation
fixed out of bound read reported by @pwn2carr
2023-08-28 12:50:55 +02:00
akallabeth
cd1da25a87 [codec,nsc] fix input length validation 2023-08-28 09:13:59 +02:00
akallabeth
b608be19e4 [codec,color] WINPR_RESTRICT for copy operations 2023-08-25 14:13:30 +02:00
akallabeth
63cb0b5f19 [codec,rfx] use WINPR_RESTRICT keyword 2023-08-25 14:13:30 +02:00
akallabeth
e975daec20 [codec,clear] fix missing bounds checks 2023-08-25 12:30:15 +02:00
akallabeth
576f836348 [codec,progressive] fix missing destination checks 2023-08-25 12:16:22 +02:00
akallabeth
11461a1b6d [codec,interleaved] fix bounds checks 2023-08-25 12:01:05 +02:00
akallabeth
7a71441476 [warnings] fix integer multiplications
Ensure the integer width for size arguments is 64bit in a
multiplication. Leading 64bit constant 1ull expands width, a trailing
one is ignored.
2023-08-22 11:55:00 +02:00
liuxiaojun
6e5f74e462 optimize idwt extrapolate decoder with neon 2023-08-22 10:54:48 +02:00
akallabeth
859b1b5f0b [codec,nsc] ensure integer width
ensure multiplication result is 64bit
2023-08-22 10:26:56 +02:00
Armin Novak
9f967b4942 [codec,color] fix freerdp_image_fill
in case width or height == 0 out of bounds write might happen.
reported by @pwn2carr
2023-08-21 11:43:50 +02:00
Armin Novak
e204fc8be5 [coded,rfx] check indices are within range
reported by @pwn2carr
2023-08-21 11:41:06 +02:00
Armin Novak
1ca6362498 [codec,rfx] free content of currentMessage on fail 2023-08-21 11:39:40 +02:00
Armin Novak
10a29dbc99 [codec,nsc] fix missing plane length check
reported by @pwn2carr
2023-08-21 11:38:13 +02:00
akallabeth
63a2f65618 [codec,rfx] fix possible out of bound read
Allows malicious servers to crash FreeRDP based clients
reported by @pwn2carr
2023-08-04 15:09:59 +02:00
Joan Torres
c843e35b75 [codec] encode messages considering endianness
The byte order of the pixels is affected by endianness, use bitwise
operations to access those bytes so the endiannes won't affect the final
result.
2023-08-01 07:56:16 +02:00
Joan Torres
a332db7cf5 [libfreerdp] fix endianness issues
There were some fields sent without considering endianness, making the
clients fail when parsing those fields.

Use Data_Write_XXX functions so the endiannes won't affect the byte order
and the clients will read properly the fields.
2023-08-01 07:56:16 +02:00
Armin Novak
4e1781740c [codec,test] fix wrong format string 2023-07-31 08:32:43 +02:00
Armin Novak
1618677e13 [codec,progressive] fix warnings 2023-07-31 08:32:43 +02:00
ehdgks0627
d04ba8d6ef Correct typos and formatting errors in format strings
In several files, fixed typos in format strings that were causing unexpected output and formatting issues.
2023-07-28 15:34:46 +02:00
Armin Novak
c4528d58bc [codec,rfx] fix shift bitwidth warnings 2023-07-28 13:42:12 +02:00
Armin Novak
4fef924531 [codec,interleaved] fix type width warnings 2023-07-28 13:42:12 +02:00
Armin Novak
c728bb9647 [codec,ncrush] fix type cast warnings 2023-07-28 13:42:12 +02:00
Armin Novak
60dc504494 [codec,rfx] fix sign warnings 2023-07-28 13:42:12 +02:00
Armin Novak
0aab55d492 [codec,progressive] fixed sign warnings 2023-07-28 13:42:12 +02:00
Armin Novak
7dc8a4a51d [codec,planar] fixed sign warnings 2023-07-28 13:42:12 +02:00
Armin Novak
32b9eeb3c0 [winpr,sysinfo] deprecage GetVersionInfoEx
the function is deprecated under windows, so deprecate it in WinPR too
and remove/replace usage
2023-07-28 13:42:12 +02:00
Armin Novak
1e0ca536c7 [ci,nightly] use internal MD4, MD5 and RC4 on windows 2023-07-28 13:42:12 +02:00
Armin Novak
b1dee0f56c [codec,rfx] fix sign warnings 2023-07-27 21:05:43 +02:00
Armin Novak
723056dab3 [codec,audio] fix warnings 2023-07-27 20:02:43 +02:00
Armin Novak
e61880d077 [standard] replace __FUNCTION__ with __func__ 2023-07-27 20:02:43 +02:00
Martin Fleisz
622a2a8df0 misc: More int to BOOL conversion fixes
This is a follow up to #9129.

This PR fixes some problematic `int` to `BOOL` conversions that might
cause overflows when checking for bit flags.
2023-07-04 09:45:20 +02:00
akallabeth
e03b6596c6 [build] fix unused but set variable warnings 2023-06-29 18:34:51 +02:00
David Fort
27a5ea64f0 [codecs] fix R and B inversion when decoding planar 2023-06-28 10:57:55 +02:00
Vic Lee
5fffaf6cd2 [codec,rfx] missing palette setting api. 2023-06-27 08:54:54 +02:00
akallabeth
1fc0d5b4b1 [winpr] remove casts for winpr_RAND calls 2023-06-21 09:57:52 +02:00
akallabeth
6121ace62a [codec,rfx] unify tile allocation 2023-06-12 16:32:23 +02:00
akallabeth
93d8a93556 [codec,rfx] assert rfx_write_tile arguments
Ensure that in all paths the function arguments are valid.
2023-06-12 16:32:23 +02:00
akallabeth
a64dd36073 [build] fixed const warnings 2023-06-12 16:32:23 +02:00
Armin Novak
47e9503385 [codec,dsp] fix unused variable warning 2023-06-08 08:11:05 +02:00
Armin Novak
d0c5b1ae42 [codec,dsp] fix ffmpeg deprecations 2023-06-08 08:09:33 +02:00
Armin Novak
a4c6b36a19 [build] fix memory sanitizer stack frame warnings 2023-06-07 09:14:45 +02:00
houchengqiu
7fe1f15edd [libfreerdp] add null pointer check in planar_decompress()
In Windows remote run vulnerabillities exe program, to create rdpgrfx
channel, may case Remmina crash.
So, add null pointer check to pSrcData.
2023-05-22 12:10:29 +02:00
Armin Novak
0ad7480d0e [codec] reset all YUV context data 2023-05-22 11:51:12 +02:00
David Fort
4e24b966c8 [codec,progressive] fix segfault and optimize updated tiles
The number of updated tiles was not reset at the end of a progressive block
treatment leading to possibly overflow the updatedTiles array. This patch also
introduces a dirty bit on tiles, so that a tile updated multiple times is just
mark once as modified.
2023-05-11 16:31:42 +02:00
Armin Novak
01e4624ed7 [progressive] fix tile cache resize
ensure that the new cache size is larger than required.
2023-05-08 17:32:41 +02:00
akallabeth
c950ca375c [client,common] fix value present flag check
need to check for COMMAND_LINE_VALUE_PRESENT instad of COMMAND_LINE_ARGUMENT_PRESENT
2023-04-28 07:39:35 +02:00
akallabeth
516668d02b [fclose] ensure no invalid pointers are passed.
fclose has undefined behaviour for NULL pointers, so check for these.
2023-04-28 07:39:35 +02:00
akallabeth
7739815a90 [codec,h264] add getter/setter for h264 options 2023-04-11 10:58:03 +02:00
akallabeth
983c820f16 [codecs] make h264 and planar opaque 2023-04-11 10:58:03 +02:00
Armin Novak
f66110c611 [codec,rfx] refactor API
* Hide implementation details
* Add missing getter/setter
2023-04-05 20:41:42 +02:00
Armin Novak
a86218c761 [codec,rfx] fix numTile update
ensure there are enough tiles allocated before setting
2023-04-05 20:41:42 +02:00
Armin Novak
2285d912eb [codec,rfx] add more assertions 2023-04-05 20:41:42 +02:00
Armin Novak
fcf3d0517e [codec,rfx] clean up free functions
* automatically set message->freeRects internally
2023-04-05 20:41:42 +02:00
Armin Novak
77f4d96fef [codec,rfx] use dynamic logger 2023-04-05 20:41:42 +02:00
Armin Novak
2bc5ac3638 [codec,rfx] assert arguments 2023-04-05 20:41:42 +02:00
Armin Novak
e94661ef71 [codec,rfx] fix rfx encoding 2023-04-05 20:41:42 +02:00
akallabeth
c840d127e9 [codec,yuv] use aligned allocation 2023-03-28 11:34:52 +02:00
akallabeth
b96e1bf577 [codec,progressive] use aligned allocation 2023-03-28 11:34:52 +02:00
akallabeth
4795ee5eac [codec,planar] use aligned allocation 2023-03-28 11:34:52 +02:00
akallabeth
0297a58638 [codec,nsc] use aligned allocation 2023-03-28 11:34:52 +02:00
akallabeth
544e488686 [codec,rfx] use aligned allocation 2023-03-28 11:34:52 +02:00
akallabeth
ac14d7614c [codec,interleaved] use aligned allocation 2023-03-28 11:34:52 +02:00
akallabeth
915aed6668 [codec,clear] use aligned allocation 2023-03-28 11:34:52 +02:00
akallabeth
a5d7325164 [codec,progressive] resize tile cache by constant
The previouse size increment was power of two, which might run out of
memory really fast. Use a constant size increment instead.
2023-03-24 11:14:17 +01:00
akallabeth
ec095bc6dd [codec,progressive] simplify tile cache allocation 2023-03-24 11:14:17 +01:00
David Fort
2fed8fb62e [codec] fix tile usage in progressive
This is a fix for #8816. When PROGRESSIVE_SURFACE_CONTEXT.tiles were reallocated, we were
ending up with wrong tiles in PROGRESSIVE_BLOCK_REGION.tiles when the memory block was moved.
2023-03-23 15:28:55 +01:00
David Fort
b7b46b8123 [codecs] make progressive honor threading flags
Progressive codec was not honoring the threading flags in settings like does
remoteFX, so even when no multiple threads decoding was asked, progressive was
using multiple threads anyway. This patch fixes it.
2023-03-20 15:32:28 +01:00
akallabeth
a5b42f0f84 [includes] untangled circular includes 2023-03-15 08:22:23 +01:00
Armin Novak
e496771034 [warnings] fixed unused-variable warnings 2023-03-06 10:04:59 +01:00
akallabeth
aa2cb9aa5f Fixed #8686: Update h264 to use new FFMPEG API 2023-02-27 09:45:44 +01:00
akallabeth
f9f32a335e [codec,progressive] fixed parsing of blocks
only provide a substream to the block parsing functions
2023-01-27 09:36:02 +01:00
Armin Novak
1dc2225bd2 [winpr,wlog] include function name in log message
default to print the function the log message was called from
2023-01-25 16:26:39 +01:00
Armin Novak
641022b795 [logging] remove __FUNCTION__ from actual message
prefer the log formatter to provide that information.
2023-01-25 16:26:39 +01:00
akallabeth
075506f6c8 [winpr,stream] use new Stream_CheckAndLogRequiredLength* 2023-01-25 14:27:32 +01:00
Armin Novak
40a309a5b9 [codec] keep alpha plane
some codecs do not support an alpha channel. keep the destination alpha
value for these as the alpha data can be set using alpha codec
separately.
2023-01-10 11:49:02 +01:00
Armin Novak
78eb6ce3a8 [codec] add flag for freerdp_image_copy
Add FREERDP_KEEP_DST_ALPHA to copy and keep the destination alpha value
2023-01-10 11:49:02 +01:00
akallabeth
d399c1c6fb [codec,xcrush] follow up to #8529
There was still an issue left, if diff == 0 then the loop counter did
never increment.
Skip this case now completely as the memory does not need to be copied
anyway.
2022-12-13 15:41:58 +01:00
akallabeth
f67a7aa16a [build] added WITH_DEBUG_CODECS
A new build option to enable more verbose logging in some video codecs.
2022-12-13 13:38:25 +01:00
akallabeth
d27972518f [codec,interleaved] move length check out of loop 2022-12-13 13:38:25 +01:00
Armin Novak
6f6353d76f [codec,interleaved] add codec debug log 2022-12-13 13:38:25 +01:00
Armin Novak
1428b73490 [codec,interleaved] refactored run length reading 2022-12-13 13:38:25 +01:00
Armin Novak
0dc5c94476 [codec,interleaved] added string helper functions 2022-12-13 13:38:25 +01:00
Armin Novak
2648257caa [codec,interleaved] add proper debug logging
log reason for decoder to fail
2022-12-13 13:38:25 +01:00
akallabeth
549aad655a [codec,xcrush] fix possible div by zero
If source and destination buffers are equal the calculation of
'rest = num % div' is a division by zero. Avoid that by checking
explicitly for that condition.
2022-12-13 13:37:54 +01:00
akallabeth
adb3b22609 Revert "fix xcrush-divideByZero (when src ==dst)"
This reverts commit 85e830d16f.
2022-12-13 13:37:54 +01:00
akallabeth
050a2d0e74 [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
2022-12-09 16:40:54 +01:00
akallabeth
7ab917dca8 Fixed Wsign-compare warnings 2022-12-09 15:58:26 +01:00
akallabeth
0186a9b303 Fixed some warnings 2022-12-09 15:58:26 +01:00
Mihai Radu
2bc13d50a3 fix xcrush-divideByZero (when src ==dst) 2022-12-07 17:48:11 +01:00
Armin Novak
8de60f9472 Fixed -Wextra-semi-stmt 2022-11-21 10:12:31 +01:00
Armin Novak
dacebc62a3 Use Stream_CheckAndLogRequiredLength, fix WLog TAG
* Log stream length requirement violations
* Use proper defines for WLog tags
2022-11-21 09:57:27 +01:00
akallabeth
5b90d0bc1d Added missing length checks in zgfx_decompress_segment 2022-11-14 09:28:22 +01:00
Martin Fleisz
0629bb9c20 codec: Fix broken logging in progressive codec 2022-11-14 09:27:41 +01:00
Armin Novak
b04c0e7b1c Fix const warnings in ffmpeg h264 module 2022-11-03 11:58:17 +01:00