vlc | branch: master | Thomas Guillem <[email protected]> | Tue May 3 11:54:47 2016 +0200| [29c1c3fb7be01137bc6014864c84311bc97f872a] | committer: Thomas Guillem
subpicture: YUVP subpicture formats should have a valid palette And return NULL if the palette allocation fails since most callers will assume that the palette will be valid. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=29c1c3fb7be01137bc6014864c84311bc97f872a --- src/misc/subpicture.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c index 7f5d109..3ea95d8 100644 --- a/src/misc/subpicture.c +++ b/src/misc/subpicture.c @@ -206,12 +206,26 @@ subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt ) if( !p_region ) return NULL; - video_format_Copy( &p_region->fmt, p_fmt ); - if ( p_fmt->i_chroma != VLC_CODEC_YUVP ) + if ( p_fmt->i_chroma == VLC_CODEC_YUVP ) { - free( p_region->fmt.p_palette ); + video_format_Copy( &p_region->fmt, p_fmt ); + /* YUVP should have a palette */ + if( p_region->fmt.p_palette == NULL ) + { + p_region->fmt.p_palette = calloc( 1, sizeof(*p_region->fmt.p_palette) ); + if( p_region->fmt.p_palette == NULL ) + { + free( p_region ); + return NULL; + } + } + } + else + { + p_region->fmt = *p_fmt; p_region->fmt.p_palette = NULL; } + p_region->i_alpha = 0xff; if( p_fmt->i_chroma == VLC_CODEC_TEXT ) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
