mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Rearrange terms to make it self-evident that overflow cannot happen
This commit is contained in:
parent
c09b3ab2c7
commit
801608f8f4
@ -1530,7 +1530,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
++entry_start;
|
++entry_start;
|
||||||
|
|
||||||
/* A sample depth should follow the separator, and we should be on it */
|
/* A sample depth should follow the separator, and we should be on it */
|
||||||
if (length < 2 || entry_start > buffer + length - 2)
|
if (length < 2 || entry_start - buffer > length - 2)
|
||||||
{
|
{
|
||||||
png_chunk_benign_error(png_ptr, "malformed");
|
png_chunk_benign_error(png_ptr, "malformed");
|
||||||
return;
|
return;
|
||||||
@ -1948,7 +1948,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
/* We need to have at least 12 bytes after the purpose string
|
/* We need to have at least 12 bytes after the purpose string
|
||||||
* in order to get the parameter information.
|
* in order to get the parameter information.
|
||||||
*/
|
*/
|
||||||
if (png_ptr->chunk_length < 12 || endptr <= buf + 12)
|
if (png_ptr->chunk_length < 12 || endptr - buf <= 12)
|
||||||
{
|
{
|
||||||
png_chunk_benign_error(png_ptr, "invalid");
|
png_chunk_benign_error(png_ptr, "invalid");
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user