[vlc-commits] Xiph: do not use invalid Track number values
Jean-Baptiste Kempf
git at videolan.org
Mon May 15 12:06:13 CEST 2017
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon May 15 12:05:31 2017 +0200| [11ac3e238a53d65361719ea36fcc4995fc4e62d0] | committer: Jean-Baptiste Kempf
Xiph: do not use invalid Track number values
Close #18323
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11ac3e238a53d65361719ea36fcc4995fc4e62d0
---
modules/demux/xiph_metadata.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/modules/demux/xiph_metadata.c b/modules/demux/xiph_metadata.c
index a67b848474..29cc4eb48b 100644
--- a/modules/demux/xiph_metadata.c
+++ b/modules/demux/xiph_metadata.c
@@ -451,20 +451,19 @@ void vorbis_ParseComment( es_format_t *p_fmt, vlc_meta_t **pp_meta,
/* Yeah yeah, such a clever idea, let's put xx/xx inside TRACKNUMBER
* Oh, and let's not use TRACKTOTAL or TOTALTRACKS... */
short unsigned u_track, u_total;
- if( sscanf( &psz_comment[strlen("TRACKNUMBER=")], "%hu/%hu", &u_track, &u_total ) == 2 )
+ int nb_values = sscanf( &psz_comment[strlen("TRACKNUMBER=")], "%hu/%hu", &u_track, &u_total );
+ if( nb_values >= 1 )
{
char str[6];
snprintf(str, 6, "%u", u_track);
vlc_meta_Set( p_meta, vlc_meta_TrackNumber, str );
hasMetaFlags |= XIPHMETA_TrackNum;
- snprintf(str, 6, "%u", u_total);
- vlc_meta_Set( p_meta, vlc_meta_TrackTotal, str );
- hasMetaFlags |= XIPHMETA_TrackTotal;
- }
- else
- {
- vlc_meta_Set( p_meta, vlc_meta_TrackNumber, &psz_comment[strlen("TRACKNUMBER=")] );
- hasMetaFlags |= XIPHMETA_TrackNum;
+ if( nb_values >= 2 )
+ {
+ snprintf(str, 6, "%u", u_total);
+ vlc_meta_Set( p_meta, vlc_meta_TrackTotal, str );
+ hasMetaFlags |= XIPHMETA_TrackTotal;
+ }
}
}
else IF_EXTRACT_ONCE("TRACKTOTAL=", TrackTotal )
More information about the vlc-commits
mailing list