mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.0.12beta1.tar
This commit is contained in:
24
pngrutil.c
24
pngrutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.11 - April 27, 2001
|
||||
* libpng 1.0.12beta1 - May 14, 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)
|
||||
@@ -339,7 +339,9 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_ptr->bit_depth = (png_byte)bit_depth;
|
||||
png_ptr->interlaced = (png_byte)interlace_type;
|
||||
png_ptr->color_type = (png_byte)color_type;
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
png_ptr->filter_type = (png_byte)filter_type;
|
||||
#endif
|
||||
|
||||
/* find number of channels */
|
||||
switch (png_ptr->color_type)
|
||||
@@ -396,6 +398,13 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
png_ptr->mode |= PNG_HAVE_PLTE;
|
||||
|
||||
if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Ignoring PLTE chunk in grayscale PNG");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
|
||||
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
@@ -512,9 +521,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_error(png_ptr, "No image in file");
|
||||
|
||||
/* to quiet compiler warnings about unused info_ptr */
|
||||
if (info_ptr == NULL)
|
||||
return;
|
||||
info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
|
||||
}
|
||||
|
||||
png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
|
||||
@@ -2083,8 +2090,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_crc_finish(png_ptr, skip);
|
||||
|
||||
#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
if (info_ptr == NULL)
|
||||
/* quiet compiler warnings about unused info_ptr */ ;
|
||||
info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2545,9 +2551,7 @@ png_do_read_interlace(png_structp png_ptr)
|
||||
(png_uint_32)row_info->pixel_depth + 7) >> 3);
|
||||
}
|
||||
#if !defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||
/* silence compiler warning */
|
||||
if (transformations)
|
||||
return;
|
||||
transformations = transformations; /* silence compiler warning */
|
||||
#endif
|
||||
}
|
||||
#endif /* !PNG_HAVE_ASSEMBLER_READ_INTERLACE */
|
||||
@@ -2964,7 +2968,9 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
png_error(png_ptr, "This image requires a row greater than 64KB");
|
||||
#endif
|
||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
|
||||
#if defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)
|
||||
png_ptr->row_buf_size = row_bytes;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)
|
||||
|
||||
Reference in New Issue
Block a user