[libpng16] Avoid potentially dereferencing NULL info_ptr in png_info_init_3().

This commit is contained in:
Glenn Randers-Pehrson 2015-07-25 08:03:05 -05:00
parent e10b7e73db
commit 59a82b40b0

6
png.c
View File

@ -413,6 +413,8 @@ png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
free(info_ptr); free(info_ptr);
info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL, info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
(sizeof *info_ptr))); (sizeof *info_ptr)));
if (info_ptr == NULL)
return;
*ptr_ptr = info_ptr; *ptr_ptr = info_ptr;
} }
@ -766,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.19beta01 - July 24, 2015" PNG_STRING_NEWLINE \ "libpng version 1.6.19beta01 - July 25, 2015" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.19beta01 - July 24, 2015\ return "libpng version 1.6.19beta01 - July 25, 2015\
Copyright (c) 1998-2015 Glenn Randers-Pehrson\ Copyright (c) 1998-2015 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";