Commit e00360d9 authored by Christophe Massiot's avatar Christophe Massiot

* modules/codec/png.c: More robust error checking, avoid calling abort() in

   case of an invalid file.
parent ebeb35dc
......@@ -137,8 +137,31 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->b_error = VLC_FALSE;
p_png = png_create_read_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
if( p_png == NULL )
{
block_Release( p_block ); *pp_block = NULL;
return NULL;
}
p_info = png_create_info_struct( p_png );
if( p_info == NULL )
{
png_destroy_read_struct( &p_png, png_infopp_NULL, png_infopp_NULL );
block_Release( p_block ); *pp_block = NULL;
return NULL;
}
p_end_info = png_create_info_struct( p_png );
if( p_end_info == NULL )
{
png_destroy_read_struct( &p_png, &p_info, png_infopp_NULL );
block_Release( p_block ); *pp_block = NULL;
return NULL;
}
/* libpng longjmp's there in case of error */
if( setjmp( png_jmpbuf( p_png ) ) )
goto error;
png_set_read_fn( p_png, (void *)p_block, user_read );
png_set_error_fn( p_png, (void *)p_dec, user_error, user_warning );
......
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