Commit 0d4a5de9 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

SSA: do not use memmove

Ref #7210
(cherry picked from commit 2a8983fe255ba7e531ca9aeeca46617b295955d2)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent cbf66df4
...@@ -1003,7 +1003,7 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle, ...@@ -1003,7 +1003,7 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle,
{ {
const char *s = TextGetLine( txt ); const char *s = TextGetLine( txt );
int h1, m1, s1, c1, h2, m2, s2, c2; int h1, m1, s1, c1, h2, m2, s2, c2;
char *psz_text; char *psz_text, *psz_temp;
char temp[16]; char temp[16];
if( !s ) if( !s )
...@@ -1046,9 +1046,14 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle, ...@@ -1046,9 +1046,14 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle,
int i_layer = ( p_sys->i_type == SUB_TYPE_ASS ) ? atoi( temp ) : 0; int i_layer = ( p_sys->i_type == SUB_TYPE_ASS ) ? atoi( temp ) : 0;
/* ReadOrder, Layer, %s(rest of fields) */ /* ReadOrder, Layer, %s(rest of fields) */
snprintf( temp, sizeof(temp), "%d,%d,", i_idx, i_layer ); if( asprintf( &psz_temp, "%d,%d,%s", i_idx, i_layer, psz_text ) == -1 )
memmove( psz_text + strlen(temp), psz_text, strlen(psz_text)+1 ); {
memcpy( psz_text, temp, strlen(temp) ); free( psz_text );
return VLC_ENOMEM;
}
free( psz_text );
psz_text = psz_temp;
} }
p_subtitle->i_start = ( (int64_t)h1 * 3600*1000 + p_subtitle->i_start = ( (int64_t)h1 * 3600*1000 +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment