[vlc-commits] [Git][videolan/vlc][3.0.x] 4 commits: http/chunked: use ptrdiff_t for sscanf() size
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Tue Nov 10 19:07:38 UTC 2026
Rémi Denis-Courmont pushed to branch 3.0.x at VideoLAN / VLC
Commits:
03877b6d by Rémi Denis-Courmont at 2026-11-10T20:58:23+02:00
http/chunked: use ptrdiff_t for sscanf() size
Fixes #30321.
(cherry picked from commit 8879ee7bdc47d9a86b9af816da101cc52c475181)
- - - - -
e90c1964 by Rémi Denis-Courmont at 2026-11-10T20:58:23+02:00
vdr: use ptrdiff_t for sscanf() size
(cherry picked from commit 7226248f8648cc15433e74dd3911e690f1f39e9c)
- - - - -
cc013292 by Rémi Denis-Courmont at 2026-11-10T20:58:23+02:00
avformat: use ptrdiff_t for sscanf()/printf() size
(cherry picked from commit 5b47df5503ef02c13bcd1123eff7d989f0e38b2e)
- - - - -
395374f1 by Rémi Denis-Courmont at 2026-11-10T20:58:23+02:00
subtitle: use ptrdiff_t for sscanf() size
(cherry picked from commit 43b8a17cf2b597f2ff30fb963d6bdf64d24709bb)
- - - - -
4 changed files:
- modules/access/http/chunked.c
- modules/access/vdr.c
- modules/demux/avformat/demux.c
- modules/demux/subtitle.c
Changes:
=====================================
modules/access/http/chunked.c
=====================================
@@ -81,9 +81,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/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/demux/avformat/demux.c
=====================================
@@ -1010,15 +1010,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(int64_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;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b72f94a6391c3793618e2d1cb36a134a1261dc14...395374f129b79eabc21ab3fda663ca4fce201886
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b72f94a6391c3793618e2d1cb36a134a1261dc14...395374f129b79eabc21ab3fda663ca4fce201886
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