[devel] Avoid a possible NULL dereference in debug builds

in png_set_text-2().  Bug discovered by Evan Rouault, using cochinelle.
This commit is contained in:
Glenn Randers-Pehrson
2009-07-27 22:08:25 -05:00
parent 78389d8396
commit e2a118f81a
7 changed files with 12 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.4.0 [July 25, 2009]
* Last changed in libpng 1.4.0 [July 28, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -713,7 +713,8 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
{
int i;
png_debug1(1, "in %s storage function", (png_ptr->chunk_name[0] == '\0' ?
png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
png_ptr->chunk_name[0] == '\0') ?
"text" : (png_const_charp)png_ptr->chunk_name));
if (png_ptr == NULL || info_ptr == NULL || num_text == 0)