~ubuntu-branches/ubuntu/intrepid/libpng/intrepid-security

« back to all changes in this revision

Viewing changes to pngrio.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2006-11-21 19:07:43 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20061121190743-wkt0yzs5uq2xoq10
Tags: 1.2.13-4
Removed drop_pass_width patch. Closes: #399499.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/* pngrio.c - functions for data input
3
3
 *
4
 
 * libpng 1.2.8 - December 3, 2004
 
4
 * Last changed in libpng 1.2.13 November 13, 2006
5
5
 * For conditions of distribution and use, see copyright notice in png.h
6
 
 * Copyright (c) 1998-2004 Glenn Randers-Pehrson
 
6
 * Copyright (c) 1998-2006 Glenn Randers-Pehrson
7
7
 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8
8
 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
9
9
 *
18
18
#define PNG_INTERNAL
19
19
#include "png.h"
20
20
 
 
21
#if defined(PNG_READ_SUPPORTED)
 
22
 
21
23
/* Read the data from whatever input you are using.  The default routine
22
24
   reads from a file pointer.  Note that this routine sometimes gets called
23
25
   with very small lengths, so you should implement some kind of simple
44
46
{
45
47
   png_size_t check;
46
48
 
 
49
   if(png_ptr == NULL) return;
47
50
   /* fread() returns 0 on error, so it is OK to store this in a png_size_t
48
51
    * instead of an int, which is what fread() actually returns.
49
52
    */
67
70
#define NEAR_BUF_SIZE 1024
68
71
#define MIN(a,b) (a <= b ? a : b)
69
72
 
70
 
static void /* PRIVATE */
 
73
static void PNGAPI
71
74
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
72
75
{
73
76
   int check;
74
77
   png_byte *n_data;
75
78
   png_FILE_p io_ptr;
76
79
 
 
80
   if(png_ptr == NULL) return;
77
81
   /* Check if data really is near. If so, use usual code. */
78
82
   n_data = (png_byte *)CVT_PTR_NOCHECK(data);
79
83
   io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
134
138
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
135
139
   png_rw_ptr read_data_fn)
136
140
{
 
141
   if(png_ptr == NULL) return;
137
142
   png_ptr->io_ptr = io_ptr;
138
143
 
139
144
#if !defined(PNG_NO_STDIO)
159
164
   png_ptr->output_flush_fn = NULL;
160
165
#endif
161
166
}
 
167
#endif /* PNG_READ_SUPPORTED */