Commit graph

14967 commits

Author SHA1 Message Date
Wim Taymans
cd00ea2462 security: clear sensitive auth data from stack buffers in RAOP
Information Disclosure: Medium

The MD5_hash() function formats password material into a 1024-byte
stack buffer for hashing but never clears it afterward. Similarly,
the Basic auth path in rtsp_add_raop_auth_header() formats
username:password into a stack buffer without clearing it.

These buffers remain on the stack after the functions return, and
could be exposed through memory disclosure vulnerabilities, core
dumps, or memory inspection.

Clear the buffers with explicit_bzero() immediately after they are
no longer needed, consistent with the existing practice of clearing
the password before freeing in impl_destroy().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 17:49:43 +02:00
Wim Taymans
2c78c1e1fb security: fix integer overflows in netjack2 float packet handling
Memory Safety: High

In netjack2_recv_float(), several values from untrusted network packet
headers are used in arithmetic without overflow protection:

1. active_ports from the network header had no upper bound check. A
   very large value causes `active_ports * sub_period_bytes` to
   overflow uint32_t, producing a small value that passes the length
   check, then the loop iterates out of bounds on the receive buffer.

2. The sub_cycle bounds check `sub_cycle * sub_period_size >
   quantum_limit` can overflow, allowing a large sub_cycle to pass
   the check and cause an out-of-bounds write when computing the
   destination offset.

Fix by capping active_ports to MAX_CHANNELS, casting to size_t for the
length check to prevent overflow, and rewriting the sub_cycle check as
a division to avoid overflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 17:48:15 +02:00
Wim Taymans
e277a91842 security: fix integer overflows in netjack2 MIDI packet handling
Memory Safety: High

In netjack2_recv_midi(), the offset calculation `max_size * sub_cycle`
uses sub_cycle from an untrusted network packet header. A large
sub_cycle value could cause integer overflow, producing a small offset
that passes the subsequent bounds check and leads to an out-of-bounds
write into the MIDI data buffer.

Similarly, the bounds check `offset + len < midi_size` could itself
overflow, and the `used` size calculation from network-controlled
event_count and write_pos fields could overflow to bypass the size
check.

Fix by adding an explicit overflow check before the multiplication,
rewriting the bounds check to use subtraction (which cannot overflow
after the prior check), and adding an underflow check on the `used`
calculation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 17:47:27 +02:00
Wim Taymans
8d352fe52e security: fix integer overflow in PulseAudio message buffer allocation
Memory Safety: High

In ensure_size(), the check `m->length + size <= m->allocated` could
overflow when both m->length and size are large uint32_t values,
wrapping around to a small number and incorrectly passing the bounds
check. This could allow writing past the end of the allocated buffer.

Rewrite the check as `size <= m->allocated - m->length` which cannot
overflow since we already verified m->length <= m->allocated. Also add
an explicit overflow check for the new allocation size calculation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 17:46:47 +02:00
Wim Taymans
05bcfa7a2a security: fix missing fdopen() NULL check in conf.c
Memory Safety: Medium

In pw_conf_save_state(), the return value of fdopen() was not checked
for NULL. If fdopen() fails, subsequent fprintf() and fclose() calls
would operate on a NULL FILE pointer, causing a crash. Additionally,
the file descriptor would be leaked since fclose() would not be called.

Added a NULL check after fdopen() that closes the raw fd and returns
an error on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 17:45:29 +02:00
Wim Taymans
6798f591bd security: clear RAOP password from memory before freeing
Information Disclosure: Medium

The RAOP authentication password was freed without first clearing the
memory contents. This leaves the plaintext password in freed heap
memory where it could be recovered by an attacker with access to
process memory (e.g. via /proc/pid/mem, core dumps, or a separate
memory safety vulnerability).

Use explicit_bzero() to securely clear the password before freeing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:59:20 +02:00
Wim Taymans
e75f72476b security: fix missing malloc NULL checks in pffft
Memory Safety: Medium

In new_setup_simd(), the return value of malloc() for the PFFFT_Setup
struct was not checked before dereferencing. Similarly,
pffft_aligned_malloc() for the data buffer was not checked. If either
allocation fails, the code dereferences NULL causing a crash.

Add NULL checks for both allocations, freeing previously allocated
memory on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:59:17 +02:00
Wim Taymans
2ccb8a7d88 security: fix integer overflow in DSF file buffer allocation
Memory Safety: High

When parsing a DSF audio file, blocksize and channels are read as
uint32_t from untrusted file data and multiplied together for the
buffer allocation. A malicious file could set these to values whose
product overflows, resulting in a small allocation followed by
out-of-bounds writes when the buffer is filled.

Add overflow checking before the multiplication and validate that
neither value is zero. Also use calloc(channels, blocksize) instead
of calloc(1, blocksize * channels) to let calloc perform its own
internal overflow check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:59:14 +02:00
Wim Taymans
440f24f35f security: fix missing strdup NULL checks in RAOP authentication
Memory Safety: High

In rtsp_do_options_auth(), the return values of strdup() for
auth_method, realm, and nonce were not checked for NULL. If strdup()
fails due to memory exhaustion, spa_streq() on auth_method will
dereference NULL, and the realm/nonce pointers will be used later in
MD5_hash() causing NULL pointer dereferences.

Add NULL checks after each strdup() call, returning -ENOMEM on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:59:10 +02:00
Wim Taymans
508407b350 security: fix missing malloc/realloc NULL checks in pw-dot
Memory Safety: High

In dot_data_init(), the return value of malloc() was not checked before
dereferencing, causing a NULL pointer dereference if allocation fails.

In dot_data_ensure_max_size(), the return value of realloc() was
assigned directly to dd->data without checking for NULL, which both
loses the original pointer (memory leak) and causes a NULL pointer
dereference on subsequent use.

Add NULL checks for both cases. For realloc, use a temporary variable
to preserve the original pointer on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:58:06 +02:00
Wim Taymans
b414d2af19 pw-top: use spa_strbuf to create status bar
There is nothing wrong with the use of strcat here but security tools
keep complaining about it and creating bad patches for it so fix it
with a strbuf.
2026-04-23 16:29:16 +02:00
Wim Taymans
135620ab64 security: fix missing malloc NULL checks in echo-cancel
Memory Safety: High

Three malloc calls for ring buffers (rec_buffer, play_buffer,
out_buffer) had no NULL checks. If any allocation fails, the
NULL pointers would be passed to memset and ringbuffer
operations in reset_buffers(), causing a NULL pointer
dereference crash.

Additionally, the ring size calculations used uint32_t
arithmetic which could overflow with large user-configurable
buffer.max_size values. Cast to size_t to perform the
multiplication in 64-bit, preventing intermediate overflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:25:19 +02:00
Wim Taymans
9cf4d05c9e security: fix unbounded strcpy for JACK port names
Memory Safety: Medium

strcpy was used to copy port names into fixed-size buffers
(REAL_JACK_PORT_NAME_SIZE+1) without explicit bounds checking.
Port names originate from JACK client API calls and PipeWire
port info, which are external inputs. Replaced with snprintf
using sizeof(destination) to guarantee the copy is always
bounded, preventing potential buffer overflows if source
strings exceed the expected maximum length.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:25:16 +02:00
Wim Taymans
329e0ddb02 security: fix unbounded sprintf in pw_conf_save_state
Memory Safety: Low

sprintf was used to format a temporary filename into an alloca'd
buffer. While the buffer was correctly sized (strlen + 5), using
snprintf with an explicit size makes the bound check enforceable
and prevents potential overflow if the sizing logic is modified
in the future.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:25:11 +02:00
Wim Taymans
46e732c28b security: fix unbounded sprintf in RAOP MD5 hash formatting
Memory Safety: Low

sprintf was used to format MD5 hex digest bytes into a fixed-size
buffer without explicit bounds. While the output is bounded by the
fixed MD5 digest length (16 bytes = 32 hex chars), using snprintf
with an explicit size of 3 (2 hex chars + null) ensures correctness
even if the surrounding code changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:25:01 +02:00
Wim Taymans
6353eb526d security: fix unbounded sprintf in check_flatpak
Memory Safety: Medium

sprintf was used to format a /proc path without bounds checking.
While pid_t values are practically bounded, using snprintf with
sizeof(root_path) ensures the buffer cannot overflow regardless
of the input value, following defense-in-depth principles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 16:24:46 +02:00
Wim Taymans
2707269118 doc: try to improve the docs 2026-04-23 13:59:41 +02:00
Wim Taymans
bb9d306399 audioconvert: also benchmark the inter versions 2026-04-23 09:38:01 +02:00
Wim Taymans
596047aaef resample: use some extra accumulators to improve pipelining 2026-04-23 09:32:31 +02:00
Wim Taymans
75e432a49a resample: use independent accumulators for SSE and SSSE3 2026-04-23 09:18:08 +02:00
Wim Taymans
37f9f7773c resample: implement inter for ssse3 2026-04-22 18:28:25 +02:00
Wim Taymans
dfeca5806f resample: don't use hadd, it is slow 2026-04-22 18:23:33 +02:00
Wim Taymans
a0518e28bb audioconvert: avoid some float/double/int conversions 2026-04-22 18:00:59 +02:00
Wim Taymans
9c9a5ac435 convolver: returned processed samples 2026-04-22 16:13:56 +02:00
Wim Taymans
495c1c9dd0 dsp: precalculate the scale 2026-04-22 16:13:56 +02:00
Wim Taymans
3c2552e671 dsp: add SSE and AVX2 mult and linear functions 2026-04-22 16:13:56 +02:00
Wim Taymans
3e7e61dcb7 convolver: small cleanups
Remove unused field.
We can also remove the ifft and reuse the fft.
2026-04-22 16:13:56 +02:00
Wim Taymans
aabcbf1261 dsp: move scaling out of complex multiply
do scaling as part of iFFT.
2026-04-22 16:13:56 +02:00
Wim Taymans
7fc020098c dsp: shuffle per implementation 2026-04-22 16:13:56 +02:00
Wim Taymans
46b8380490 dsp: store Real/Imag in blocks of 8
Shuffle FFT output into real/imag blocks so that they are easier to
handle in the complex multiply. Do the unshuffle again before doing the
inverse FFT.
2026-04-22 16:12:20 +02:00
Charles
43b19e7668 gst: fix crop height typo in pipewiresink do_send_buffer
The crop region height was incorrectly set to meta->width instead of
meta->height when copying GstVideoCropMeta into the SPA buffer.
2026-04-21 20:19:24 +01:00
Wang Yu
2953f48d9b vulkan: fix wrong descriptor image info index
When streams are skipped via continue in updateDescriptors(),
the loop index i and descriptorSetLen diverge. The image info
is written at descriptorSetLen but pImageInfo was referencing
index i, pointing to uninitialized memory and causing incorrect
Vulkan descriptor updates.

Fix by using descriptorSetLen consistently.

Signed-off-by: Wang Yu <wangyu@uniontech.com>
2026-04-21 15:13:03 +00:00
Wim Taymans
da19aa4eb1 filter-chain: update virtual surround with convolver2 2026-04-21 17:03:55 +02:00
Wim Taymans
c6ae30593c filter-graph: use convolver2 for sofa
We don't need 2 convolvers anymore, we can use the same convolver with
2 outputs with the left and right ir.

Add latency option to the sofa plugin. I believe the latency of the
SOFA filters is by default 0, so use that.
2026-04-21 16:52:49 +02:00
Wim Taymans
9cae4ce7e7 filter-chain: add convolver2
Add support for multiple convolver outputs. This makes things more
efficient because we only need to do the input FFT once to produce the N
outputs.

Add convolver2 that can have multiple outputs.
2026-04-21 16:24:38 +02:00
Wim Taymans
2b96f694f7 convolver: rename some fields 2026-04-20 14:00:15 +02:00
Wim Taymans
d8db536d36 convolver: remove some useless loops 2026-04-20 14:00:04 +02:00
Wim Taymans
777851a7ec convolver: support more than 2 partitions
Currently wired up to only support 2 but it can be changed.
2026-04-20 13:59:08 +02:00
Wim Taymans
b9e62aad8a convolver: handle partial blocks 2026-04-20 13:57:47 +02:00
zhiwei zuo
c5e1a3eae3 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2026-04-20 10:06:31 +00:00
zuozhiwei
0a38fedeec conf: clamp pw_strv_insert_at invalid pos to [0, len]
Invalid pos was clamped to len+1, which could insert past the terminating NULL.
Clamp negative indices to 0 and values above len to len.
2026-04-20 10:06:31 +00:00
hackerman-kl
f0a33cddbd module-avb: es_builder: use the descriptor rather than a pointer to avoid overwriting it 2026-04-20 10:10:58 +02:00
zuozhiwei
2722d16303 audioadapter: remap port id for port_reuse_buffer on target
port_use_buffers and related port methods increment port_id when the
implicit output direction differs from the adapter's primary direction.
port_reuse_buffer only receives a port id but applies to output ports,
so apply the same offset before forwarding to this->target.

Also update videoadapter for the same mapping.
2026-04-20 07:55:54 +00:00
zuozhiwei
c3d16a39f5 audioconvert: fix tmp_datas[1] when scratch ports grow 2026-04-20 10:24:42 +08:00
Pauli Virtanen
cee1bdfb5a bluez5: more MT7925 quirks
The MT7925 chipset has several alternative USB ids recognized by kernel,
list them all.
2026-04-19 16:02:56 +00:00
hackerman-kl
e66a24dc5b modules-avb: legacy-avb: entity warnings 2026-04-19 08:15:55 +02:00
Pauli Virtanen
84e6845aa6 bluez5: add quirk for LC3-24kHz for HFP
MT7925 fails to setup a SCO connection that results to working LC3-24kHz
audio. Other controllers (Intel etc) appear to work OK.

Add quirk for disabling this codec, and disable it for this Mediatek
controller.
2026-04-17 22:10:32 +00:00
Pauli Virtanen
6e8e234e61 bluez5: fix disabling HFP codecs via bluez5.codecs
backend-native should not advertise disabled HFP codecs as available.
2026-04-17 19:35:43 +03:00
Wim Taymans
7df106bc25 filter-chain: deactivate when Format is unset
We need to deactivate the graph when the format was cleared on both the
input and output. This means we got suspended and we need to clear. We
can safely do this now because we take the right locks.
2026-04-17 13:05:28 +02:00
Wim Taymans
5f9811d085 convolver: clear the input buffer
The last part of the buffer needs to be 0 filled or else we get noise
from the FFT.
2026-04-17 12:47:32 +02:00