[vlc-devel] [PATCH] fix abort (crash) if EPG string is not UTF8

Abylay Ospan aospan at netup.ru
Mon Nov 20 22:52:21 CET 2017


libvlc aborted if non english ATSC EPG strings arrived:

in vlc_meta_Set (p_meta=<optimized out>,
meta_type=meta_type at entry=vlc_meta_ESNowPlaying,
psz_val=psz_val at entry=0x7fffb5054530 "Pok\351mon") at input/meta.c:131
in EsOutProgramEpg (p_epg=<optimized out>, i_group=<optimized out>,
out=<optimized out>) at input/es_out.c:1408
...
in ATSC_EIT_Callback (p_pid=0x7fffb500b690, p_eit=0x7fffb5045710) at
demux/mpeg/ts_psip.c:505

Better just not display this string than abort.
---
 src/input/meta.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/input/meta.c b/src/input/meta.c
index 241b926079..80325b1249 100644
--- a/src/input/meta.c
+++ b/src/input/meta.c
@@ -124,8 +124,7 @@ void vlc_meta_Delete( vlc_meta_t *m )
 void vlc_meta_Set( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val )
 {
     free( p_meta->ppsz_meta[meta_type] );
-    assert( psz_val == NULL || IsUTF8( psz_val ) );
-    p_meta->ppsz_meta[meta_type] = psz_val ? strdup( psz_val ) : NULL;
+    p_meta->ppsz_meta[meta_type] = (psz_val && IsUTF8( psz_val )) ? strdup( psz_val ) : NULL;
 }
 
 const char *vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t meta_type )
-- 
2.11.0



More information about the vlc-devel mailing list