mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Check (png_uint_16) casts for overflow. Also removed png_muldiv_warn,
added RELEASE/!RELEASE convenience macros. png_muldiv_warn was used in only one place, and the overflow condition is a genuine warning not an internal error. Four macros allow code or function parameters to be condition on RELEASE (or not) builds and tidy up the #ifdef handling of functions.
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
36562c1032
commit
53097f5bbb
10
pngrutil.c
10
pngrutil.c
@@ -1812,7 +1812,7 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
}
|
||||
|
||||
png_crc_read(png_ptr, readbuf, length);
|
||||
png_ptr->num_trans = (png_uint_16)length;
|
||||
png_ptr->num_trans = png_check_u16(png_ptr, length);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1907,9 +1907,11 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
return;
|
||||
}
|
||||
|
||||
background.red = (png_uint_16)png_ptr->palette[buf[0]].red;
|
||||
background.green = (png_uint_16)png_ptr->palette[buf[0]].green;
|
||||
background.blue = (png_uint_16)png_ptr->palette[buf[0]].blue;
|
||||
background.red = png_check_u16(png_ptr, png_ptr->palette[buf[0]].red);
|
||||
background.green =
|
||||
png_check_u16(png_ptr, png_ptr->palette[buf[0]].green);
|
||||
background.blue =
|
||||
png_check_u16(png_ptr, png_ptr->palette[buf[0]].blue);
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user