mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.2.0beta4.tar
This commit is contained in:
26
pngrutil.c
26
pngrutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.2.0beta3 - May 18, 2001
|
||||
* libpng 1.2.0beta4 - June 23, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -794,12 +794,12 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
{
|
||||
if (abs(int_x_white - 31270L) > 1000 ||
|
||||
abs(int_y_white - 32900L) > 1000 ||
|
||||
abs( int_x_red - 64000L) > 1000 ||
|
||||
abs( int_y_red - 33000L) > 1000 ||
|
||||
abs(int_x_red - 64000L) > 1000 ||
|
||||
abs(int_y_red - 33000L) > 1000 ||
|
||||
abs(int_x_green - 30000L) > 1000 ||
|
||||
abs(int_y_green - 60000L) > 1000 ||
|
||||
abs( int_x_blue - 15000L) > 1000 ||
|
||||
abs( int_y_blue - 6000L) > 1000)
|
||||
abs(int_x_blue - 15000L) > 1000 ||
|
||||
abs(int_y_blue - 6000L) > 1000)
|
||||
{
|
||||
|
||||
png_warning(png_ptr,
|
||||
@@ -928,12 +928,12 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
if (info_ptr->valid & PNG_INFO_cHRM)
|
||||
if (abs(info_ptr->int_x_white - 31270L) > 1000 ||
|
||||
abs(info_ptr->int_y_white - 32900L) > 1000 ||
|
||||
abs( info_ptr->int_x_red - 64000L) > 1000 ||
|
||||
abs( info_ptr->int_y_red - 33000L) > 1000 ||
|
||||
abs(info_ptr->int_x_red - 64000L) > 1000 ||
|
||||
abs(info_ptr->int_y_red - 33000L) > 1000 ||
|
||||
abs(info_ptr->int_x_green - 30000L) > 1000 ||
|
||||
abs(info_ptr->int_y_green - 60000L) > 1000 ||
|
||||
abs( info_ptr->int_x_blue - 15000L) > 1000 ||
|
||||
abs( info_ptr->int_y_blue - 6000L) > 1000)
|
||||
abs(info_ptr->int_x_blue - 15000L) > 1000 ||
|
||||
abs(info_ptr->int_y_blue - 6000L) > 1000)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Ignoring incorrect cHRM value when sRGB is also present");
|
||||
@@ -1029,6 +1029,13 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
profile_length = data_length - prefix_length;
|
||||
|
||||
if ( profile_length < 4)
|
||||
{
|
||||
png_free(png_ptr, chunkdata);
|
||||
png_warning(png_ptr, "Profile size field missing from iCCP chunk");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check the profile_size recorded in the first 32 bits of the ICC profile */
|
||||
profile_size = ((*(chunkdata+prefix_length))<<24) |
|
||||
((*(chunkdata+prefix_length+1))<<16) |
|
||||
@@ -1040,6 +1047,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
if(profile_size > profile_length)
|
||||
{
|
||||
png_free(png_ptr, chunkdata);
|
||||
png_warning(png_ptr, "Ignoring truncated iCCP profile.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user