mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Coverity related changes
These should fix most of the reported Coverity issues. The remaining issues should be the back_b etc assignments, which look like a Coverity bug, and passing a pointer to a byte to a function that expects a pointer to one or more bytes, which should (I believe) be fixed in one case and not the other (next_filter) case; the latter case will probably go away as I am going to rewrite that piece of code to avoid a spurious buffer allocation. Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
d280c3a6da
commit
f8d3e854cb
55
pngerror.c
55
pngerror.c
@@ -1162,6 +1162,34 @@ PNG_FUNCTION(void,png_affirm,(png_const_structrp png_ptr,
|
||||
# endif /* AFFIRM_ERROR */
|
||||
}
|
||||
|
||||
#if !PNG_RELEASE_BUILD
|
||||
void /* PRIVATE */
|
||||
png_handled_affirm(png_const_structrp png_ptr, png_const_charp message,
|
||||
unsigned int position)
|
||||
{
|
||||
# if PNG_RELEASE_BUILD
|
||||
/* testing in RC: we want to return control to the caller, so do not
|
||||
* use png_affirm.
|
||||
*/
|
||||
char buffer[512];
|
||||
|
||||
affirm_text(buffer, message, position);
|
||||
|
||||
# ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||
fprintf(stderr, "%s\n", buffer);
|
||||
# elif defined PNG_WARNINGS_SUPPORTED
|
||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
||||
png_ptr->warning_fn(png_constcast(png_structrp, png_ptr), buffer);
|
||||
/* else no way to output the text */
|
||||
# else
|
||||
PNG_UNUSED(png_ptr)
|
||||
# endif
|
||||
# else
|
||||
png_affirm(png_ptr, message, position);
|
||||
# endif
|
||||
}
|
||||
#endif /* !RELEASE_BUILD */
|
||||
|
||||
#ifdef PNG_RANGE_CHECK_SUPPORTED
|
||||
/* The character/byte checking APIs. These do their own calls to png_affirm
|
||||
* because the caller provides the position.
|
||||
@@ -1209,32 +1237,5 @@ png_u16_affirm(png_const_structrp png_ptr, unsigned int position, int b)
|
||||
png_affirm(png_ptr, param_deb("PNG 16-bit range") position);
|
||||
}
|
||||
#endif /* INT_MAX >= 65535 */
|
||||
|
||||
void /* PRIVATE */
|
||||
png_handled_affirm(png_const_structrp png_ptr, png_const_charp message,
|
||||
unsigned int position)
|
||||
{
|
||||
# if PNG_RELEASE_BUILD
|
||||
/* testing in RC: we want to return control to the caller, so do not
|
||||
* use png_affirm.
|
||||
*/
|
||||
char buffer[512];
|
||||
|
||||
affirm_text(buffer, message, position);
|
||||
|
||||
# ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||
fprintf(stderr, "%s\n", buffer);
|
||||
# elif defined PNG_WARNINGS_SUPPORTED
|
||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
||||
png_ptr->warning_fn(png_constcast(png_structrp, png_ptr), buffer);
|
||||
/* else no way to output the text */
|
||||
# else
|
||||
PNG_UNUSED(png_ptr)
|
||||
# endif
|
||||
# else
|
||||
png_affirm(png_ptr, message, position);
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif /* RANGE_CHECK */
|
||||
#endif /* READ || WRITE */
|
||||
|
||||
Reference in New Issue
Block a user