[libpng15] Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c

PNG_DEBUG builds.
This commit is contained in:
Glenn Randers-Pehrson 2015-05-09 21:44:18 -05:00
parent 58a54220dd
commit 8583cc23e4
3 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.23beta01 - April 29, 2015 Libpng 1.5.23beta01 - May 10, 2015
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -27,11 +27,14 @@ Other information:
Changes since the last public release (1.5.22): Changes since the last public release (1.5.22):
Version 1.5.23beta01 [April 29, 2015] Version 1.5.23beta01 [May 10, 2015]
Removed unused PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED definitions Removed unused PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED definitions
from pnglibconf.h.prebuilt (Andrew Church). from pnglibconf.h.prebuilt (Andrew Church).
Replaced "unexpected" with an integer in pngset.c where a long was Replaced "unexpected" with an integer in pngset.c where a long was
expected, to avoid a compiler warning when PNG_DEBUG > 1. expected, to avoid a compiler warning when PNG_DEBUG > 1.
Fix typecast in a png_debug2() statement in png_set_text_2() to
avoid a compiler warning in PNG_DEBUG builds.
Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -4334,11 +4334,14 @@ Version 1.5.22rc04 [March 16, 2015]
Version 1.5.22 [March 26, 2015] Version 1.5.22 [March 26, 2015]
No changes. No changes.
Version 1.5.23beta01 [April 29, 2015] Version 1.5.23beta01 [May 10, 2015]
Removed unused PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED definitions Removed unused PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED definitions
from pnglibconf.h.prebuilt (Andrew Church). from pnglibconf.h.prebuilt (Andrew Church).
Replaced "unexpected" with an integer in pngset.c where a long was Replaced "unexpected" with an integer in pngset.c where a long was
expected, to avoid a compiler warning when PNG_DEBUG > 1. expected, to avoid a compiler warning when PNG_DEBUG > 1.
Fix typecast in a png_debug2() statement in png_set_text_2() to
avoid a compiler warning in PNG_DEBUG builds.
Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -564,6 +564,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
} }
/* Unlink the element from the list. */ /* Unlink the element from the list. */
if (pinformation != NULL)
{ {
memory_infop *ppinfo = &pinformation; memory_infop *ppinfo = &pinformation;
@ -580,7 +581,6 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* We must free the list element too, but first kill /* We must free the list element too, but first kill
the memory that is to be freed. */ the memory that is to be freed. */
memset(ptr, 0x55, pinfo->size); memset(ptr, 0x55, pinfo->size);
if (pinfo != NULL)
free(pinfo); free(pinfo);
pinfo = NULL; pinfo = NULL;
break; break;
@ -1463,8 +1463,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_tIME(write_ptr, write_end_info_ptr, mod_time); png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
#ifdef PNG_TIME_RFC1123_SUPPORTED #ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use memcpy instead of "=" because the string /* We have to use memcpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before * pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */ * we use it.
*/
memcpy(tIME_string, memcpy(tIME_string,
png_convert_to_rfc1123(read_ptr, mod_time), png_convert_to_rfc1123(read_ptr, mod_time),
png_sizeof(tIME_string)); png_sizeof(tIME_string));