mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Added byte, short and other overflow checking
Added 'assert' based overflow checking for debug builds for char and short assignments. Simply ignore the error in release builds (a truncated value will be used without warning). Controlled by PNG_RANGE_CHECK_SUPPORTED.
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
382de60042
commit
82fa6aed0e
10
pngget.c
10
pngget.c
@@ -1117,7 +1117,7 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
return info_ptr->unknown_chunks_num;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1125,7 +1125,9 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_byte PNGAPI
|
||||
png_get_rgb_to_gray_status (png_const_structrp png_ptr)
|
||||
{
|
||||
return (png_byte)((png_ptr ? png_ptr->rgb_to_gray_status : 0) & 0xff);
|
||||
if (png_ptr)
|
||||
return png_ptr->rgb_to_gray_status;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1133,7 +1135,9 @@ png_get_rgb_to_gray_status (png_const_structrp png_ptr)
|
||||
png_voidp PNGAPI
|
||||
png_get_user_chunk_ptr(png_const_structrp png_ptr)
|
||||
{
|
||||
return (png_ptr ? png_ptr->user_chunk_ptr : NULL);
|
||||
if (png_ptr)
|
||||
return png_ptr->user_chunk_ptr;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user