mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Revert change to png_default_read_data() made in libpng-1.7.0beta55.
This commit is contained in:
parent
5ff2d472e8
commit
e4521a073c
10
ANNOUNCE
10
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.7.0beta57 - March 15, 2015
|
||||
Libpng 1.7.0beta57 - March 17, 2015
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@ -750,8 +750,12 @@ Version 1.7.0beta56 [March 11, 2015]
|
||||
Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
|
||||
for consistency, and remove some useless tests (Alexey Petruchik).
|
||||
|
||||
Version 1.7.0beta57 [March 15, 2015]
|
||||
Remove pnglibconf.h, not pnglibconf.* in "make clean" (Cosmin).
|
||||
Version 1.7.0beta57 [March 17, 2015]
|
||||
Remove pnglibconf.h, pnglibconf.c, and pnglibconf.out instead of
|
||||
pnglibconf.* in "make clean" (Cosmin).
|
||||
Fix bug in calculation of maxbits, in png_write_sBIT, introduced
|
||||
in libpng-1.6.17beta01 (John Bowler).
|
||||
Revert change to png_default_read_data() made in libpng-1.7.0beta55.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
||||
8
CHANGES
8
CHANGES
@ -5040,8 +5040,12 @@ Version 1.7.0beta56 [March 11, 2015]
|
||||
Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
|
||||
for consistency, and remove some useless tests (Alexey Petruchik).
|
||||
|
||||
Version 1.7.0beta57 [March 15, 2015]
|
||||
Remove pnglibconf.h, not pnglibconf.* in "make clean" (Cosmin).
|
||||
Version 1.7.0beta57 [March 17, 2015]
|
||||
Remove pnglibconf.h, pnglibconf.c, and pnglibconf.out instead of
|
||||
pnglibconf.* in "make clean" (Cosmin).
|
||||
Fix bug in calculation of maxbits, in png_write_sBIT, introduced
|
||||
in libpng-1.6.17beta01 (John Bowler).
|
||||
Revert change to png_default_read_data() made in libpng-1.7.0beta55.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
||||
38
pngrio.c
38
pngrio.c
@ -49,42 +49,18 @@ png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||
void PNGCBAPI
|
||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_FILE_p io_ptr;
|
||||
png_size_t check;
|
||||
|
||||
io_ptr = png_get_io_ptr(png_ptr);
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (length == 0)
|
||||
png_error(png_ptr, "Read Error: invalid length requested");
|
||||
|
||||
clearerr(io_ptr);
|
||||
|
||||
if (fileno(io_ptr) == -1)
|
||||
png_error(png_ptr, "Read Error: invalid io_ptr");
|
||||
|
||||
/*
|
||||
* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
/* 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.
|
||||
*/
|
||||
if ((png_size_t)fread((void *)data, sizeof (png_byte), length,
|
||||
io_ptr) != length)
|
||||
{
|
||||
clearerr(io_ptr);
|
||||
png_error(png_ptr, "Read Error: invalid length returned");
|
||||
}
|
||||
check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
|
||||
|
||||
if (ferror(io_ptr))
|
||||
{
|
||||
clearerr(io_ptr);
|
||||
png_error(png_ptr, "Read Error: error returned by fread()");
|
||||
}
|
||||
|
||||
if (feof(io_ptr))
|
||||
{
|
||||
clearerr(io_ptr);
|
||||
png_error(png_ptr, "Read Error: unexpected end of file");
|
||||
}
|
||||
|
||||
clearerr(io_ptr);
|
||||
if (check != length)
|
||||
png_error(png_ptr, "Read Error");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user