[libpng17] Worked around a false-positive Coverity issue in pngvalid.c.

This commit is contained in:
Glenn Randers-Pehrson 2016-01-13 09:48:41 -06:00
parent 6271b4fc78
commit 89287f10b8
3 changed files with 18 additions and 5 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.7.0beta77 - January 12, 2016 Libpng 1.7.0beta77 - January 13, 2016
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.
@ -1172,7 +1172,7 @@ Version 1.7.0beta76 [January 7, 2016]
Fixed new Coverity defect, potential NULL dereference of "ps" in pngwutil.c Fixed new Coverity defect, potential NULL dereference of "ps" in pngwutil.c
Added temporary workaround for Coverity "Dead code" defect. Added temporary workaround for Coverity "Dead code" defect.
Version 1.7.0beta77 [January 12, 2016] Version 1.7.0beta77 [January 13, 2016]
Fixed new Coverity defect, another NULL dereference of "ps" in pngwutil.c Fixed new Coverity defect, another NULL dereference of "ps" in pngwutil.c
Prevent the CMINFO optimization code from running twice on any PNG IDAT Prevent the CMINFO optimization code from running twice on any PNG IDAT
stream longer than 2048 bytes; the second time could overwrite bytes stream longer than 2048 bytes; the second time could overwrite bytes
@ -1212,6 +1212,7 @@ Version 1.7.0beta77 [January 12, 2016]
there is an unrelated bug which means that lower zlib memLevels result there is an unrelated bug which means that lower zlib memLevels result
in memory corruption under some circumstances, probably less often in memory corruption under some circumstances, probably less often
than 1:1000. than 1:1000.
Worked around a false-positive Coverity issue in pngvalid.c.
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

@ -5471,7 +5471,7 @@ Version 1.7.0beta76 [January 7, 2016]
Fixed new Coverity defect, potential NULL dereference of "ps" in pngwutil.c Fixed new Coverity defect, potential NULL dereference of "ps" in pngwutil.c
Added temporary workaround for Coverity "Dead code" defect. Added temporary workaround for Coverity "Dead code" defect.
Version 1.7.0beta77 [January 12, 2016] Version 1.7.0beta77 [January 13, 2016]
Fixed new Coverity defect, another NULL dereference of "ps" in pngwutil.c Fixed new Coverity defect, another NULL dereference of "ps" in pngwutil.c
Prevent the CMINFO optimization code from running twice on any PNG IDAT Prevent the CMINFO optimization code from running twice on any PNG IDAT
stream longer than 2048 bytes; the second time could overwrite bytes stream longer than 2048 bytes; the second time could overwrite bytes
@ -5511,6 +5511,7 @@ Version 1.7.0beta77 [January 12, 2016]
there is an unrelated bug which means that lower zlib memLevels result there is an unrelated bug which means that lower zlib memLevels result
in memory corruption under some circumstances, probably less often in memory corruption under some circumstances, probably less often
than 1:1000. than 1:1000.
Worked around a false-positive Coverity issue in pngvalid.c.
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

@ -309,8 +309,13 @@ static void r16(png_uint_16p p16, size_t count)
} }
} }
#define R16(this)\ #ifdef __COVERITY__
# define R16(this)\
r16(&(this), (sizeof (this))/2U/*(sizeof (png_uint_16))*/)
#else
# define R16(this)\
r16(&(this), (sizeof (this))/(sizeof (png_uint_16))) r16(&(this), (sizeof (this))/(sizeof (png_uint_16)))
#endif
#if defined PNG_READ_RGB_TO_GRAY_SUPPORTED ||\ #if defined PNG_READ_RGB_TO_GRAY_SUPPORTED ||\
defined PNG_READ_FILLER_SUPPORTED defined PNG_READ_FILLER_SUPPORTED
@ -326,8 +331,14 @@ static void r32(png_uint_32p p32, size_t count)
} }
} }
#define R32(this)\ #ifdef __COVERITY__
# define R32(this)\
r32(&(this), (sizeof (this))/4U/*(sizeof (png_uint_32))*/)
#else
# define R32(this)\
r32(&(this), (sizeof (this))/(sizeof (png_uint_32))) r32(&(this), (sizeof (this))/(sizeof (png_uint_32)))
#endif
#endif /* READ_FILLER || READ_RGB_TO_GRAY */ #endif /* READ_FILLER || READ_RGB_TO_GRAY */
#endif /* READ || WRITE_tRNS || WRITE_FILTER */ #endif /* READ || WRITE_tRNS || WRITE_FILTER */