[vlc-commits] [Git][videolan/vlc][master] 7 commits: http/chunked: use ptrdiff_t for sscanf() size
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Nov 9 13:40:05 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
8879ee7b by Rémi Denis-Courmont at 2026-11-09T13:19:58+00:00
http/chunked: use ptrdiff_t for sscanf() size
Fixes #30321.
- - - - -
f8e445a2 by Rémi Denis-Courmont at 2026-11-09T13:19:58+00:00
rtp: use ptrdiff_t for sscanf() size
- - - - -
7226248f by Rémi Denis-Courmont at 2026-11-09T13:19:58+00:00
vdr: use ptrdiff_t for sscanf() size
- - - - -
b879cbc9 by Rémi Denis-Courmont at 2026-11-09T13:19:58+00:00
fluidsynth: use ptrdiff_t for printf() size
- - - - -
5b47df55 by Rémi Denis-Courmont at 2026-11-09T13:19:58+00:00
avformat: use ptrdiff_t for sscanf()/printf() size
- - - - -
43b8a17c by Rémi Denis-Courmont at 2026-11-09T13:19:58+00:00
subtitle: use ptrdiff_t for sscanf() size
- - - - -
f7caf792 by Rémi Denis-Courmont at 2026-11-09T13:19:58+00:00
vobsub: use ptrdiff_t for sscanf() size
- - - - -
8 changed files:
- modules/access/http/chunked.c
- modules/access/rtp/rtpfmt.c
- modules/access/rtp/sdp.c
- modules/access/vdr.c
- modules/codec/fluidsynth.c
- modules/demux/avformat/demux.c
- modules/demux/subtitle.c
- modules/demux/vobsub.c
Changes:
=====================================
modules/access/http/chunked.c
=====================================
@@ -107,9 +107,9 @@ static block_t *vlc_chunked_read(struct vlc_http_stream *stream)
return vlc_chunked_fatal(s);
}
- int end;
+ ptrdiff_t end;
- if (sscanf(line, "%" SCNxMAX "%n", &s->chunk_length, &end) < 1
+ if (sscanf(line, "%" SCNxMAX "%tn", &s->chunk_length, &end) < 1
|| (line[end] != '\0' && line[end] != ';' /* ignore extension(s) */))
s->chunk_length = UINTMAX_MAX;
=====================================
modules/access/rtp/rtpfmt.c
=====================================
@@ -260,11 +260,11 @@ int vlc_rtp_add_media_types(vlc_object_t *obj, rtp_session_t *session,
} else if (strcmp(a->name, "fmtp") == 0) {
unsigned char number;
- int offset;
+ ptrdiff_t offset;
- if (sscanf(a->value, "%hhu %n", &number, &offset) == 1
+ if (sscanf(a->value, "%hhu %tn", &number, &offset) == 1
&& number < ARRAY_SIZE(types))
- types[number].parameters = a->value + offset;
+ types[number].parameters = a->value + (size_t)offset;
}
}
=====================================
modules/access/rtp/sdp.c
=====================================
@@ -100,18 +100,19 @@ bad:
c->addr[addrlen] = '\0';
if (len >= 7 && memcmp(net_type, "IN ", 3) == 0) {
- int offset = 0, val = -1;
+ ptrdiff_t offset = 0;
+ int val = -1;
if (memcmp(addr_type, "IP4 ", 4) == 0) {
/* IPv4 */
c->family = 4;
- val = sscanf(c->addr, "%*[^/]%n/%hhu/%hu", &offset, &c->ttl,
+ val = sscanf(c->addr, "%*[^/]%tn/%hhu/%hu", &offset, &c->ttl,
&c->addr_count);
} else if (memcmp(addr_type, "IP6 ", 4) == 0) {
/* IPv6 */
c->family = 6;
- val = sscanf(c->addr, "%*[^/]%n/%hu", &offset, &c->addr_count);
+ val = sscanf(c->addr, "%*[^/]%tn/%hu", &offset, &c->addr_count);
}
if (val >= 0)
=====================================
modules/access/vdr.c
=====================================
@@ -175,9 +175,9 @@ static int Open( vlc_object_t *p_this )
if( b_strict )
{
char psz_extension[4];
- int i_length = 0;
+ ptrdiff_t i_length = 0;
const char *psz_name = BaseName( p_access->psz_filepath );
- if( sscanf( psz_name, "%*u-%*u-%*u.%*u.%*u.%*u%*[-.]%*u.%3s%n",
+ if( sscanf( psz_name, "%*u-%*u-%*u.%*u.%*u.%*u%*[-.]%*u.%3s%tn",
psz_extension, &i_length ) != 1 || strcasecmp( psz_extension, "rec" ) ||
( psz_name[i_length] != DIR_SEP_CHAR && psz_name[i_length] != '\0' ) )
return VLC_EGENERIC;
=====================================
modules/codec/fluidsynth.c
=====================================
@@ -137,9 +137,9 @@ static int Open (vlc_object_t *p_this)
if (likely(udd != NULL))
{
char *path;
- int len;
+ ptrdiff_t len;
- if (asprintf(&path, "%s/sound%ns/sf2/*.sf2", udd, &len) >= 0)
+ if (asprintf(&path, "%s/sound%tns/sf2/*.sf2", udd, &len) >= 0)
{
glob(path, flags, NULL, &gl);
flags |= GLOB_APPEND;
=====================================
modules/demux/avformat/demux.c
=====================================
@@ -1067,15 +1067,18 @@ static block_t *BuildSsaFrame( const AVPacket *p_pkt, unsigned i_order )
int i_layer;
int h0, m0, s0, c0;
int h1, m1, s1, c1;
- int i_position = 0;
- if( sscanf( buffer, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d,%n", &i_layer,
+ ptrdiff_t i_position = 0;
+
+ if( sscanf( buffer, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d,%tn", &i_layer,
&h0, &m0, &s0, &c0, &h1, &m1, &s1, &c1, &i_position ) < 9 )
return NULL;
- if( i_position <= 0 || (unsigned)i_position >= i_buffer_size )
+ if( i_position <= 0 || (size_t)i_position >= i_buffer_size )
return NULL;
char *p;
- if( asprintf( &p, "%u,%d,%.*s", i_order, i_layer, p_pkt->size - i_position, p_pkt->data + i_position ) < 0 )
+ if( asprintf( &p, "%u,%d,%.*s", i_order, i_layer,
+ (int)(p_pkt->size - i_position),
+ p_pkt->data + i_position ) < 0 )
return NULL;
block_t *p_frame = block_heap_Alloc( p, strlen(p) + 1 );
=====================================
modules/demux/subtitle.c
=====================================
@@ -1146,18 +1146,18 @@ static int subtitle_ParseSubRipTimingValue(vlc_tick_t *timing_value,
const char *s, size_t length)
{
int h1, m1, s1, d1 = 0;
+ ptrdiff_t count;
- int count;
- if (sscanf(s, "%d:%d:%d,%d%n", &h1, &m1, &s1, &d1, &count) == 4
+ if (sscanf(s, "%d:%d:%d,%d%tn", &h1, &m1, &s1, &d1, &count) == 4
&& (size_t)count <= length)
goto success;
- if (sscanf(s, "%d:%d:%d.%d%n", &h1, &m1, &s1, &d1, &count) == 4
+ if (sscanf(s, "%d:%d:%d.%d%tn", &h1, &m1, &s1, &d1, &count) == 4
&& (size_t)count <= length)
goto success;
d1 = 0;
- if (sscanf(s, "%d:%d:%d%n", &h1, &m1, &s1, &count) == 3
+ if (sscanf(s, "%d:%d:%d%tn", &h1, &m1, &s1, &count) == 3
&& (size_t)count <= length)
goto success;
=====================================
modules/demux/vobsub.c
=====================================
@@ -596,12 +596,13 @@ static int ParseVobSubIDX( demux_t *p_demux )
/*
* delay: [sign]hh:mm:ss:mss
*/
- int h, m, s, ms, count = 0;
+ int h, m, s, ms;
+ ptrdiff_t count = 0;
int i_sign = 1;
vlc_tick_t i_gap = 0;
if( p_sys->i_tracks > 0 &&
- sscanf( line, "%*celay: %02d%n:%02d:%02d:%03d",
+ sscanf( line, "%*celay: %02d%tn:%02d:%02d:%03d",
&h, &count, &m, &s, &ms ) >= 4 )
{
vobsub_track_t *current_tk = &p_sys->track[p_sys->i_tracks - 1];
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2eba4cdf9046578399796247ee0998605abb157f...f7caf7922478f6cb7f1654b813d0c462d3e86f4a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2eba4cdf9046578399796247ee0998605abb157f...f7caf7922478f6cb7f1654b813d0c462d3e86f4a
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