[vlc-commits] demux/avi: do not call FromACP with NULL (fixes #17581)
Filip Roséen
git at videolan.org
Tue Nov 1 22:19:16 CET 2016
vlc/vlc-2.2 | branch: master | Filip Roséen <filip at atch.se> | Tue Nov 1 02:33:03 2016 +0100| [a9dd17b9f49312c919851ce012a4a2925262d9cd] | committer: Rémi Denis-Courmont
demux/avi: do not call FromACP with NULL (fixes #17581)
FromACP is used to convert a c-style string from one charset to the
other, as such it does not make sense to call the function with NULL
(especially given that NULL is not a valid input for the function).
These changes fixes the checks to see whether or not the function is
applicable or not by properly checking the argument that would-be
passed (instead of just the object that contains it).
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit e082cac10bfd47e78f8e7096351323f3040348a8)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=a9dd17b9f49312c919851ce012a4a2925262d9cd
---
modules/demux/avi/avi.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 3a31702..d60d7b6 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -464,7 +464,7 @@ static int Open( vlc_object_t * p_this )
{
int i_chunk = AVIFOURCC_IAS1 + ((i - 1) << 24);
avi_chunk_STRING_t *p_lang = AVI_ChunkFind( p_info, i_chunk, 0 );
- if( p_lang != NULL )
+ if( p_lang != NULL && p_lang->p_str != NULL )
fmt.psz_language = FromACP( p_lang->p_str );
}
@@ -669,7 +669,7 @@ static int Open( vlc_object_t * p_this )
free( tk );
continue;
}
- if( p_strn )
+ if( p_strn && p_strn->p_str )
fmt.psz_description = FromACP( p_strn->p_str );
tk->p_es = es_out_Add( p_demux->out, &fmt );
TAB_APPEND( p_sys->i_track, p_sys->track, tk );
@@ -2699,7 +2699,7 @@ static void AVI_MetaLoad( demux_t *p_demux,
for( int i = 0; p_dsc[i].i_id != 0; i++ )
{
avi_chunk_STRING_t *p_strz = AVI_ChunkFind( p_info, p_dsc[i].i_id, 0 );
- if( !p_strz )
+ if( !p_strz || !p_strz->p_str )
continue;
char *psz_value = FromACP( p_strz->p_str );
if( !psz_value )
@@ -2723,7 +2723,7 @@ static void AVI_MetaLoad( demux_t *p_demux,
for( int i = 0; p_extra[i] != 0; i++ )
{
avi_chunk_STRING_t *p_strz = AVI_ChunkFind( p_info, p_extra[i], 0 );
- if( !p_strz )
+ if( !p_strz || !p_strz->p_str )
continue;
char *psz_value = FromACP( p_strz->p_str );
if( !psz_value )
@@ -2871,7 +2871,7 @@ static void AVI_ExtractSubtitle( demux_t *p_demux,
i_size -= 6;
if( !psz_description )
- psz_description = p_strn ? FromACP( p_strn->p_str ) : NULL;
+ psz_description = p_strn && p_strn->p_str ? FromACP( p_strn->p_str ) : NULL;
char *psz_name;
if( asprintf( &psz_name, "subtitle%d.srt", p_sys->i_attachment ) <= 0 )
psz_name = NULL;
More information about the vlc-commits
mailing list