[vlc-commits] demux/mp4: fix null-deref when FromCharset() fails
Thomas Guillem
git at videolan.org
Wed Dec 21 16:32:02 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Dec 21 16:20:17 2016 +0100| [6fca9f1489ff97fb5722baceeffa451efffddae3] | committer: Thomas Guillem
demux/mp4: fix null-deref when FromCharset() fails
FromCharset() can return NULL in case of error.
This fixes a regression introduced by 810539f.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6fca9f1489ff97fb5722baceeffa451efffddae3
---
modules/demux/mp4/meta.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/modules/demux/mp4/meta.c b/modules/demux/mp4/meta.c
index f29200e..2510c16 100644
--- a/modules/demux/mp4/meta.c
+++ b/modules/demux/mp4/meta.c
@@ -287,23 +287,26 @@ static int ExtractIntlStrings( vlc_meta_t *p_meta, MP4_Box_t *p_box )
}
char* data = FromCharset( charset, p_peek, i_len );
- if( meta_type )
+ if( data )
{
- vlc_meta_Set( p_meta_intl, *meta_type, data );
+ if( meta_type )
+ {
+ vlc_meta_Set( p_meta_intl, *meta_type, data );
- meta_key = vlc_meta_TypeToLocalizedString( *meta_type );
- meta_type = NULL;
- }
- else
- {
- char* key;
- if( asprintf( &key, "%s (%s)", meta_key, charset+11 ) != -1 )
+ meta_key = vlc_meta_TypeToLocalizedString( *meta_type );
+ meta_type = NULL;
+ }
+ else
{
- vlc_meta_AddExtra( p_meta_intl, key, data );
- free( key );
+ char* key;
+ if( asprintf( &key, "%s (%s)", meta_key, charset+11 ) != -1 )
+ {
+ vlc_meta_AddExtra( p_meta_intl, key, data );
+ free( key );
+ }
}
+ free( data );
}
- free( data );
p_peek += i_len;
i_read -= i_len;
More information about the vlc-commits
mailing list