27 * This file is available under and governed by the GNU General Public |
27 * This file is available under and governed by the GNU General Public |
28 * License version 2 only, as published by the Free Software Foundation. |
28 * License version 2 only, as published by the Free Software Foundation. |
29 * However, the following notice accompanied the original version of this |
29 * However, the following notice accompanied the original version of this |
30 * file and, per its terms, should not be removed: |
30 * file and, per its terms, should not be removed: |
31 * |
31 * |
32 * Last changed in libpng 1.6.23 [June 9, 2016] |
32 * Last changed in libpng 1.6.24 [August 4, 2016] |
33 * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson |
33 * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson |
34 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
34 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
35 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
35 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
36 * |
36 * |
37 * This code is released under the libpng license. |
37 * This code is released under the libpng license. |
103 } |
103 } |
104 |
104 |
105 png_uint_32 PNGAPI |
105 png_uint_32 PNGAPI |
106 png_process_data_skip(png_structrp png_ptr) |
106 png_process_data_skip(png_structrp png_ptr) |
107 { |
107 { |
108 /* TODO: Deprecate and remove this API. |
108 /* TODO: Deprecate and remove this API. |
109 * Somewhere the implementation of this seems to have been lost, |
109 * Somewhere the implementation of this seems to have been lost, |
110 * or abandoned. It was only to support some internal back-door access |
110 * or abandoned. It was only to support some internal back-door access |
111 * to png_struct) in libpng-1.4.x. |
111 * to png_struct) in libpng-1.4.x. |
112 */ |
112 */ |
113 png_app_warning(png_ptr, |
113 png_app_warning(png_ptr, |
114 "png_process_data_skip is not implemented in any current version of libpng"); |
114 "png_process_data_skip is not implemented in any current version of libpng"); |
115 return 0; |
115 return 0; |
116 } |
116 } |
117 |
117 |
436 |
436 |
437 else |
437 else |
438 { |
438 { |
439 PNG_PUSH_SAVE_BUFFER_IF_FULL |
439 PNG_PUSH_SAVE_BUFFER_IF_FULL |
440 png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, |
440 png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, |
441 PNG_HANDLE_CHUNK_AS_DEFAULT); |
441 PNG_HANDLE_CHUNK_AS_DEFAULT); |
442 } |
442 } |
443 |
443 |
444 png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; |
444 png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; |
445 } |
445 } |
446 |
446 |
547 png_ptr->buffer_size = 0; |
547 png_ptr->buffer_size = 0; |
548 } |
548 } |
549 |
549 |
550 void /* PRIVATE */ |
550 void /* PRIVATE */ |
551 png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer, |
551 png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer, |
552 png_size_t buffer_length) |
552 png_size_t buffer_length) |
553 { |
553 { |
554 png_ptr->current_buffer = buffer; |
554 png_ptr->current_buffer = buffer; |
555 png_ptr->current_buffer_size = buffer_length; |
555 png_ptr->current_buffer_size = buffer_length; |
556 png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; |
556 png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; |
557 png_ptr->current_buffer_ptr = png_ptr->current_buffer; |
557 png_ptr->current_buffer_ptr = png_ptr->current_buffer; |
650 } |
650 } |
651 } |
651 } |
652 |
652 |
653 void /* PRIVATE */ |
653 void /* PRIVATE */ |
654 png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, |
654 png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, |
655 png_size_t buffer_length) |
655 png_size_t buffer_length) |
656 { |
656 { |
657 /* The caller checks for a non-zero buffer length. */ |
657 /* The caller checks for a non-zero buffer length. */ |
658 if (!(buffer_length > 0) || buffer == NULL) |
658 if (!(buffer_length > 0) || buffer == NULL) |
659 png_error(png_ptr, "No IDAT data (internal error)"); |
659 png_error(png_ptr, "No IDAT data (internal error)"); |
660 |
660 |
710 if (png_ptr->row_number >= png_ptr->num_rows || |
710 if (png_ptr->row_number >= png_ptr->num_rows || |
711 png_ptr->pass > 6) |
711 png_ptr->pass > 6) |
712 png_warning(png_ptr, "Truncated compressed data in IDAT"); |
712 png_warning(png_ptr, "Truncated compressed data in IDAT"); |
713 |
713 |
714 else |
714 else |
715 png_error(png_ptr, "Decompression error in IDAT"); |
715 { |
|
716 if (ret == Z_DATA_ERROR) |
|
717 png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch"); |
|
718 else |
|
719 png_error(png_ptr, "Decompression error in IDAT"); |
|
720 } |
716 |
721 |
717 /* Skip the check on unprocessed input */ |
722 /* Skip the check on unprocessed input */ |
718 return; |
723 return; |
719 } |
724 } |
720 |
725 |
808 if (png_ptr->interlaced != 0 && |
813 if (png_ptr->interlaced != 0 && |
809 (png_ptr->transformations & PNG_INTERLACE) != 0) |
814 (png_ptr->transformations & PNG_INTERLACE) != 0) |
810 { |
815 { |
811 if (png_ptr->pass < 6) |
816 if (png_ptr->pass < 6) |
812 png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass, |
817 png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass, |
813 png_ptr->transformations); |
818 png_ptr->transformations); |
814 |
819 |
815 switch (png_ptr->pass) |
820 switch (png_ptr->pass) |
816 { |
821 { |
817 case 0: |
822 case 0: |
818 { |
823 { |
1070 void /* PRIVATE */ |
1075 void /* PRIVATE */ |
1071 png_push_have_row(png_structrp png_ptr, png_bytep row) |
1076 png_push_have_row(png_structrp png_ptr, png_bytep row) |
1072 { |
1077 { |
1073 if (png_ptr->row_fn != NULL) |
1078 if (png_ptr->row_fn != NULL) |
1074 (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, |
1079 (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, |
1075 (int)png_ptr->pass); |
1080 (int)png_ptr->pass); |
1076 } |
1081 } |
1077 |
1082 |
1078 #ifdef PNG_READ_INTERLACING_SUPPORTED |
1083 #ifdef PNG_READ_INTERLACING_SUPPORTED |
1079 void PNGAPI |
1084 void PNGAPI |
1080 png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row, |
1085 png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row, |