aboutsummaryrefslogtreecommitdiffstats
path: root/pngrio.c
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2009-07-22 11:50:02 -0400
committerPatrick Scott <phanna@android.com>2009-07-22 11:51:29 -0400
commita0bb96c34e65378853ee518bac502842d26c2d1a (patch)
treee5a1a570c92e2ef58a0d96cd3dfefbab796fb37e /pngrio.c
parent4215dd1533c56e1a89ae6f1d6ea68677fac27fda (diff)
downloadexternal_libpng-a0bb96c34e65378853ee518bac502842d26c2d1a.zip
external_libpng-a0bb96c34e65378853ee518bac502842d26c2d1a.tar.gz
external_libpng-a0bb96c34e65378853ee518bac502842d26c2d1a.tar.bz2
Update libpng to 1.2.38 to patch a minor security issue.
Diffstat (limited to 'pngrio.c')
-rw-r--r--pngrio.c63
1 files changed, 37 insertions, 26 deletions
diff --git a/pngrio.c b/pngrio.c
index f5027e7..2267bca 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,12 +1,15 @@
/* pngrio.c - functions for data input
*
- * Last changed in libpng 1.2.30 [August 15, 2008]
- * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2008 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ *
* This file provides a location for all input. Users who need
* special handling are expected to write a function that has the same
* arguments as this and performs a similar function, but that possibly
@@ -20,10 +23,11 @@
#if defined(PNG_READ_SUPPORTED)
/* Read the data from whatever input you are using. The default routine
- reads from a file pointer. Note that this routine sometimes gets called
- with very small lengths, so you should implement some kind of simple
- buffering if you are using unbuffered reads. This should never be asked
- to read more then 64K on a 16 bit machine. */
+ * reads from a file pointer. Note that this routine sometimes gets called
+ * with very small lengths, so you should implement some kind of simple
+ * buffering if you are using unbuffered reads. This should never be asked
+ * to read more then 64K on a 16 bit machine.
+ */
void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
@@ -36,16 +40,18 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#if !defined(PNG_NO_STDIO)
/* This is the function that does the actual reading of data. If you are
- not reading from a standard C stream, you should create a replacement
- read_data function and use it at run time with png_set_read_fn(), rather
- than changing the library. */
+ * not reading from a standard C stream, you should create a replacement
+ * read_data function and use it at run time with png_set_read_fn(), rather
+ * than changing the library.
+ */
#ifndef USE_FAR_KEYWORD
void PNGAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
- if (png_ptr == NULL) return;
+ if (png_ptr == NULL)
+ return;
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns.
*/
@@ -61,7 +67,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Read Error");
}
#else
-/* this is the model-independent version. Since the standard I/O library
+/* This is the model-independent version. Since the standard I/O library
can't handle far buffers in the medium and small models, we have to copy
the data.
*/
@@ -76,7 +82,8 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_byte *n_data;
png_FILE_p io_ptr;
- if (png_ptr == NULL) return;
+ if (png_ptr == NULL)
+ return;
/* Check if data really is near. If so, use usual code. */
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
@@ -121,23 +128,27 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif
/* This function allows the application to supply a new input function
- for libpng if standard C streams aren't being used.
-
- This function takes as its arguments:
- png_ptr - pointer to a png input data structure
- io_ptr - pointer to user supplied structure containing info about
- the input functions. May be NULL.
- read_data_fn - pointer to a new input function that takes as its
- arguments a pointer to a png_struct, a pointer to
- a location where input data can be stored, and a 32-bit
- unsigned int that is the number of bytes to be read.
- To exit and output any fatal error messages the new write
- function should call png_error(png_ptr, "Error msg"). */
+ * for libpng if standard C streams aren't being used.
+ *
+ * This function takes as its arguments:
+ * png_ptr - pointer to a png input data structure
+ * io_ptr - pointer to user supplied structure containing info about
+ * the input functions. May be NULL.
+ * read_data_fn - pointer to a new input function that takes as its
+ * arguments a pointer to a png_struct, a pointer to
+ * a location where input data can be stored, and a 32-bit
+ * unsigned int that is the number of bytes to be read.
+ * To exit and output any fatal error messages the new write
+ * function should call png_error(png_ptr, "Error msg").
+ * May be NULL, in which case libpng's default function will
+ * be used.
+ */
void PNGAPI
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn)
{
- if (png_ptr == NULL) return;
+ if (png_ptr == NULL)
+ return;
png_ptr->io_ptr = io_ptr;
#if !defined(PNG_NO_STDIO)