[vlc-commits] [Git][videolan/vlc][master] 2 commits: access: rist: robustness fixes in receive path and peer config
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Jun 25 15:42:38 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
b6362a25 by Sergio Ammirata at 2026-06-25T14:52:55+00:00
access: rist: robustness fixes in receive path and peer config
Fix off-by-one in RIST_MAX_QUEUE_BUFFERS check that could overflow the
rist_items array. Fix leaked librist data blocks when all received
payloads have zero length (i_total_size == 0) by routing through
failed_cleanup. Remove the i_total_size > 0 guard in failed_cleanup
since the loop is safe with i_rist_items_index == 0.
Validate the integer config values that are passed to librist's
uint32_t peer config fields: each negative value is now logged via
msg_Warn and clamped to 0. The retry interval is also clamped to
INT_MAX / 10 before being multiplied by 10 to avoid signed integer
overflow (undefined behaviour). Parenthesise the (10 * x) cast.
Include <limits.h> explicitly for INT_MAX.
Guard strdup(psz_url) against NULL to avoid undefined behaviour when
no URL is configured.
- - - - -
c9b0b564 by Sergio Ammirata at 2026-06-25T14:52:55+00:00
contrib: update librist to 0.2.18
Updates the librist contrib to the 0.2.18 release tag (Advanced/Main profile interoperability, NAT rebind recovery, and Advanced-profile correctness fixes).
- - - - -
4 changed files:
- contrib/src/librist/SHA512SUMS
- contrib/src/librist/rules.mak
- modules/access/rist.c
- modules/access/rist.h
Changes:
=====================================
contrib/src/librist/SHA512SUMS
=====================================
@@ -1 +1 @@
-906382576025b39b9ac13e4ad20648b5c2a61e215d7dc0d30e043dc3c30d6fd9586c7349cfeb2c5fd4c576e833c16dbe003c6f774a6372ea1bfc3c4fefa81663 librist-v0.2.15.tar.gz
+f561e48bb0949e702ee1765f9998fdce191dfda2011855b089ae0f3552618bb5599b1b9a1c73355d1d1e8fffd1100eb8e64365d140d1c5958127738536c72704 librist-v0.2.18.tar.gz
=====================================
contrib/src/librist/rules.mak
=====================================
@@ -1,6 +1,6 @@
# librist
-LIBRIST_VERSION := v0.2.15
+LIBRIST_VERSION := v0.2.18
LIBRIST_URL := $(VIDEOLAN_GIT)/rist/librist/-/archive/$(LIBRIST_VERSION)/librist-$(LIBRIST_VERSION).tar.gz
ifdef BUILD_NETWORK
=====================================
modules/access/rist.c
=====================================
@@ -175,8 +175,7 @@ static block_t *BlockRIST(stream_t *p_access, bool *restrict eof)
break;
}
vlc_mutex_unlock( &p_sys->lock );
- // Make sure we never read more than our array size
- if (i_rist_items_index == (RIST_MAX_QUEUE_BUFFERS -1))
+ if (i_rist_items_index >= RIST_MAX_QUEUE_BUFFERS)
break;
}
@@ -190,7 +189,7 @@ static block_t *BlockRIST(stream_t *p_access, bool *restrict eof)
}
if (i_total_size == 0) {
- return NULL;
+ goto failed_cleanup;
}
// Prepare one large buffer (when we are behing in reading, otherwise it is the same size as what is being read)
@@ -209,10 +208,8 @@ static block_t *BlockRIST(stream_t *p_access, bool *restrict eof)
return pktout;
failed_cleanup:
- if (i_total_size > 0) {
- for (size_t i = 0; i < i_rist_items_index; i++) {
- rist_receiver_data_block_free2(&p_sys->rist_items[i]);
- }
+ for (size_t i = 0; i < i_rist_items_index; i++) {
+ rist_receiver_data_block_free2(&p_sys->rist_items[i]);
}
return NULL;
}
=====================================
modules/access/rist.h
=====================================
@@ -29,6 +29,7 @@
#include <vlc_common.h>
#include <librist/librist.h>
+#include <limits.h>
/* RIST max fifo count (private RIST_DATAOUT_QUEUE_BUFFERS in librist) */
#define RIST_MAX_QUEUE_BUFFERS (1024)
@@ -141,13 +142,38 @@ static inline int rist_get_max_packet_size(vlc_object_t *p_this)
static inline bool rist_add_peers(vlc_object_t *p_this, struct rist_ctx *ctx, char *psz_url, int i_multipeer_mode, int virt_dst_port, int i_recovery_length)
{
-
-
int i_rist_reorder_buffer = var_InheritInteger( p_this, RIST_CFG_PREFIX RIST_URL_PARAM_REORDER_BUFFER );
int i_rist_retry_interval = var_InheritInteger( p_this, RIST_CFG_PREFIX RIST_CFG_RETRY_INTERVAL );
int i_rist_max_retries = var_InheritInteger( p_this, RIST_CFG_PREFIX RIST_CFG_MAX_RETRIES );
int i_rist_max_bitrate = var_InheritInteger(p_this, RIST_CFG_PREFIX RIST_URL_PARAM_BANDWIDTH);
+ if (i_recovery_length < 0) {
+ msg_Warn( p_this, "ignoring negative recovery length %d", i_recovery_length );
+ i_recovery_length = 0;
+ }
+ if (i_rist_reorder_buffer < 0) {
+ msg_Warn( p_this, "ignoring negative reorder buffer %d", i_rist_reorder_buffer );
+ i_rist_reorder_buffer = 0;
+ }
+ if (i_rist_retry_interval < 0) {
+ msg_Warn( p_this, "ignoring negative retry interval %d", i_rist_retry_interval );
+ i_rist_retry_interval = 0;
+ } else if (i_rist_retry_interval > INT_MAX / 10) {
+ i_rist_retry_interval = INT_MAX / 10;
+ }
+ if (i_rist_max_retries < 0) {
+ msg_Warn( p_this, "ignoring negative max retries %d", i_rist_max_retries );
+ i_rist_max_retries = 0;
+ }
+ if (i_rist_max_bitrate < 0) {
+ msg_Warn( p_this, "ignoring negative max bitrate %d", i_rist_max_bitrate );
+ i_rist_max_bitrate = 0;
+ }
+ if (i_multipeer_mode < 0) {
+ msg_Warn( p_this, "ignoring negative multipeer mode %d", i_multipeer_mode );
+ i_multipeer_mode = 0;
+ }
+
char *psz_stream_name = NULL;
psz_stream_name = var_InheritString( p_this, RIST_CFG_PREFIX RIST_URL_PARAM_CNAME );
@@ -166,7 +192,7 @@ static inline bool rist_add_peers(vlc_object_t *p_this, struct rist_ctx *ctx, ch
msg_Info( p_this, "Setting retry buffer to %d ms", i_recovery_length );
char *addr[] = {
- strdup(psz_url),
+ psz_url ? strdup(psz_url) : NULL,
var_InheritString( p_this, RIST_CFG_PREFIX RIST_CFG_URL2 ),
var_InheritString( p_this, RIST_CFG_PREFIX RIST_CFG_URL3 ),
var_InheritString( p_this, RIST_CFG_PREFIX RIST_CFG_URL4 )
@@ -192,7 +218,7 @@ static inline bool rist_add_peers(vlc_object_t *p_this, struct rist_ctx *ctx, ch
.recovery_length_max = (uint32_t)i_recovery_length,
.recovery_reorder_buffer = (uint32_t)i_rist_reorder_buffer,
.recovery_rtt_min = (uint32_t)i_rist_retry_interval,
- .recovery_rtt_max = (uint32_t)10*i_rist_retry_interval,
+ .recovery_rtt_max = (uint32_t)(10 * i_rist_retry_interval),
.weight = (uint32_t)i_multipeer_mode,
.congestion_control_mode = RIST_CONGESTION_CONTROL_MODE_NORMAL,
.min_retries = 6,
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2051c2f33ab3caa958b3f5f4038335e8cc3fa7ea...c9b0b564b2f73eb41cb39ef4d645cb5ea7966440
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2051c2f33ab3caa958b3f5f4038335e8cc3fa7ea...c9b0b564b2f73eb41cb39ef4d645cb5ea7966440
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list