Commit graph

4156 commits

Author SHA1 Message Date
Wim Taymans
4c8093fa72 combine-stream: clean up some variables
Move the source offs, stride, data and size calculations out of the
destination loop. We only need to clamp the size to copy to the maxsize
of the destination buffer.
2026-05-08 13:10:30 +02:00
Wim Taymans
93b940edef module-combine: limit size to buffer maxsize
Limit the amount of data we write to the destination buffer to its
maxsize.
2026-05-08 13:01:11 +02:00
Wim Taymans
6d3122c1b1 sap: avoid reading past the end of the string
parse_sdp_a_rtpmap used c += strlen(c) + 1 to skip past the MIME type to the
rate/channels part, but if the a=rtpmap: line had no / separator, strcspn
returned the full string length and the +1 advanced past the null terminator.

Fix this by checking if / was actually found, returning -EINVAL if not.
2026-05-08 11:57:07 +02:00
Wim Taymans
7fd3e13a3e netjack2: handle 0 in sync frames
JACK2 only sends -1 as the frames, meaning we should take the value from
the negotiated period as the frames to process.

We however send the actual number of frames and use the sync value to
decide how many frames to process. We need to be careful because a value
of 0 will cause a division by 0 so treat <= 0 frames the negotiated period
size as well.
2026-05-08 11:42:15 +02:00
Wim Taymans
753eae9302 netjack2: check config against MAX_CHANNELS
Check that the params don't include more than MAX_CHANNELS of audio or
else we overflow the position array.

Adapt to the compiled value of SPA_AUDIO_MAX_CHANNELS but allow at least
128 channels.
2026-05-08 11:07:03 +02:00
Wim Taymans
6cee86e509 sendspin: avoid buffer overread
Check that we have enough bytes (>=9) to parse the message type and the
timestamp.
2026-05-08 10:33:39 +02:00
Wim Taymans
22243d5ce9 sendspin: handle parse_player errors
Otherwise, this might leave the stride 0 and cause a division by 0
later.
2026-05-08 10:32:28 +02:00
Wim Taymans
5b37b9cf99 filter-graph: remove the pipe filter
It's a terrible idea, doesn't work so well (locks up the data-loop when
read is blocked) and a security mightmare. If you really need to pipe
samples through some program, do that somewhere else, like from the
command line with pw-cat and pw-record.
2026-05-08 10:16:12 +02:00
Wim Taymans
97c8a0a5ae modules: update docs for the pipe plugin 2026-05-07 14:46:21 +02:00
Wim Taymans
e3f75314be vban: fix timestamp overflows
Like how it is done in RTP.
2026-05-07 14:07:33 +02:00
Wim Taymans
e9aff3040a modules: free the stream and impl on errors 2026-05-07 13:30:12 +02:00
Wim Taymans
aa36fd5a17 pulse-server: avoid double free of props
Use spa_steal_ptr to transfer props ownership when we can.

This fixes a problem in the upload stream where the props would be freed
twice when buffer allocation failed, once with properties_free and
then with stream_free.
2026-05-07 10:30:35 +02:00
Wim Taymans
e975a44d05 modules: handle more stream setup failures
Instead of silently ignoring things.
2026-05-06 16:23:08 +02:00
Wim Taymans
c362bca5e9 loopback: handle stream setup failure
Instead of silently failing.
Also when we do the cleanup, make sure we don't free the props twice.
2026-05-06 16:07:59 +02:00
Wim Taymans
95a4772031 modules: handle get_registry NULL return value 2026-05-06 13:50:02 +02:00
Wim Taymans
ac95f1241e modules: fix portal error handling
Mostly to fix the property cleanup.
2026-05-06 13:48:35 +02:00
Wim Taymans
51b635cc98 modules: convert snprintf to strbuf
Use spa_strbuf instead of snprintf to handle errors better.
2026-05-06 13:35:09 +02:00
Wim Taymans
2c4dc2d22f raop: handle loop_add_io errors 2026-05-06 13:18:11 +02:00
Wim Taymans
cc2c7cc591 modules: handle some property allocation errors 2026-05-06 13:17:41 +02:00
Wim Taymans
f5bbdc403f profiler: fix cleanup on errors
Make an impl_destroy function to clean up partially initialized impl.
Handle failed flush_event allocation. Handle all errors in one place.
2026-05-06 12:39:39 +02:00
Wim Taymans
aac0f13487 module-echo-cancel: fix cleanup
Go to the error label to make sure verything is cleaned up properly when
loading the aec plugin fails for some reason.
2026-05-06 12:27:09 +02:00
Wim Taymans
364436dd31 rtp-sap: handle out-of-bound SAP packet read
If the SAP packet contains the MIME type string but no SDP payload after it,
sdp would point past the null-terminated buffer. Check that we are
still inside the packet before parsing the SDP.
2026-05-06 11:57:52 +02:00
Wim Taymans
d32a21c4ee rtp-sap: handle uninitialized avail
When the ioctl fails, avail might be uninitialized. Check the ioctl
return value and handle invalid avail.
2026-05-06 11:57:52 +02:00
Wim Taymans
c4a2f9b480 rtp-sap: also handle short reads
Don't only handle -1 errors from read but also short reads that could
leave the buffer with uninitialized data.
2026-05-06 11:57:52 +02:00
Wim Taymans
ca46444d13 netjack2: limit period_size to quantum_limit
To avoid large periods that might not fit in the quantum.
2026-05-06 11:57:52 +02:00
Wim Taymans
aa29fefbd2 vban: limit the stream_name
The stream_name from the network is not 0 terminated so limit the
string to the max size.
2026-05-06 11:57:52 +02:00
Wim Taymans
8907d0860b modules: loop_add_io with close=true owns the fd
We should not close the fd when loop_add_io with close=true fails
because the fd is already closed.
2026-05-06 11:57:51 +02:00
Wim Taymans
620b18e9d8 zeroconf: check for NULL before doing strdup
Reject zeroconf entries without name, type, domain or host_name.
2026-05-05 18:17:42 +02:00
Wim Taymans
593b5cf148 protocol-simple: close client_fd when client alloc fails 2026-05-05 17:19:06 +02:00
Wim Taymans
b9761926df netjack2: go to the right error label
socket_failed is for when the socket fd failed, otherwise we need to do
cleanup.
2026-05-05 17:14:02 +02:00
Wim Taymans
c2bf8c920e protocol-native: close fd and unset env in all cases
If we find the fd valid, we must attempt to close it.
Also unset the env variable when we read and processed it, even if
there was an error.
2026-05-05 17:09:12 +02:00
Wim Taymans
aa6fa6bdc3 modules: make sure we don't deref potential NULL 2026-05-05 16:39:27 +02:00
Wim Taymans
9124a09482 modules: handle allocation error of properties 2026-05-05 16:34:15 +02:00
Wim Taymans
f8a76d9f00 protocol-native: handle allocation failures 2026-05-05 16:26:25 +02:00
Wim Taymans
01b2af13c7 pulse-server: handle strdup error 2026-05-05 14:54:43 +02:00
Wim Taymans
899051169e netjack2: handle property allocation failures 2026-05-05 14:51:43 +02:00
Wim Taymans
67e8da3390 modules: handle some allocation failures 2026-05-05 14:44:18 +02:00
Wim Taymans
3db8038652 modules: avoid useless props copy
We can use the properties we passed to the node.
2026-05-05 14:15:44 +02:00
Wim Taymans
9946f5ec77 modules: handle some more allocation errors 2026-05-05 14:14:52 +02:00
Wim Taymans
dd695ee5a7 modules: handle allocation errors gracefully 2026-05-05 13:10:21 +02:00
Wim Taymans
96594d6716 plugins: handle some fd allocation errors 2026-05-05 11:36:45 +02:00
Barnabás Pőcze
ccfb61efa4 treewide: make more file descriptors cloexec
Avoid file descriptor leakage into child processes by marking them `O_CLOEXEC`.
2026-05-04 19:48:41 +02:00
Wim Taymans
c4b198962c jack-tunnel: pass bytes to jack_to_midi
When the buffer has n_samples, we have n_samples * sizeof(float) bytes
to fill with midi.
2026-05-04 13:51:55 +02:00
Wim Taymans
bd8eab3ffb raop: handle allocation error and avoid crash later 2026-05-04 13:46:09 +02:00
Wim Taymans
ed33b4d877 jack: dlclose on errors 2026-05-04 13:20:00 +02:00
Wim Taymans
4cf5acf18d raop: free pending messages 2026-05-04 13:16:37 +02:00
Wim Taymans
7ab2b7d24a raop: handle asprintf errors 2026-05-04 13:16:25 +02:00
Wim Taymans
a4d7607a88 raop: avoid division by 0 2026-05-04 12:26:08 +02:00
Wim Taymans
7dacdc8cc8 avb: bounds check the attribute encoding
Add a maxsize to the attribute encode functions and add checks that
they don't overwrite the provided buffer.
2026-05-04 10:47:52 +02:00
Wim Taymans
cda2e2ee17 rtp: fix ringbuffer overflow check
We write raw samples to the ringbuffer from the opus decode function so
compare the available space to the max amount of samples we can decode,
which is 2880 as passed to opus_decode.
2026-05-04 10:26:30 +02:00