|
42 | 42 | #include "pngpriv.h" |
43 | 43 |
|
44 | 44 | /* Generate a compiler error if there is an old png.h in the search path. */ |
45 | | -typedef png_libpng_version_1_6_47 Your_png_h_is_not_version_1_6_47; |
| 45 | +typedef png_libpng_version_1_6_51 Your_png_h_is_not_version_1_6_51; |
46 | 46 |
|
47 | 47 | /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the |
48 | 48 | * corresponding macro definitions. This causes a compile time failure if |
@@ -137,10 +137,16 @@ png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED) |
137 | 137 | if (png_ptr == NULL) |
138 | 138 | return NULL; |
139 | 139 |
|
140 | | - if (items >= (~(png_alloc_size_t)0)/size) |
| 140 | + /* This check against overflow is vestigial, dating back from |
| 141 | + * the old times when png_zalloc used to be an exported function. |
| 142 | + * We're still keeping it here for now, as an extra-cautious |
| 143 | + * prevention against programming errors inside zlib, although it |
| 144 | + * should rather be a debug-time assertion instead. |
| 145 | + */ |
| 146 | + if (size != 0 && items >= (~(png_alloc_size_t)0) / size) |
141 | 147 | { |
142 | | - png_warning (png_voidcast(png_structrp, png_ptr), |
143 | | - "Potential overflow in png_zalloc()"); |
| 148 | + png_warning(png_voidcast(png_structrp, png_ptr), |
| 149 | + "Potential overflow in png_zalloc()"); |
144 | 150 | return NULL; |
145 | 151 | } |
146 | 152 |
|
@@ -267,10 +273,6 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver) |
267 | 273 | png_warning(png_ptr, m); |
268 | 274 | #endif |
269 | 275 |
|
270 | | -#ifdef PNG_ERROR_NUMBERS_SUPPORTED |
271 | | - png_ptr->flags = 0; |
272 | | -#endif |
273 | | - |
274 | 276 | return 0; |
275 | 277 | } |
276 | 278 |
|
@@ -729,7 +731,7 @@ png_get_io_ptr(png_const_structrp png_ptr) |
729 | 731 | * function of your own because "FILE *" isn't necessarily available. |
730 | 732 | */ |
731 | 733 | void PNGAPI |
732 | | -png_init_io(png_structrp png_ptr, png_FILE_p fp) |
| 734 | +png_init_io(png_structrp png_ptr, FILE *fp) |
733 | 735 | { |
734 | 736 | png_debug(1, "in png_init_io"); |
735 | 737 |
|
@@ -844,7 +846,7 @@ png_get_copyright(png_const_structrp png_ptr) |
844 | 846 | return PNG_STRING_COPYRIGHT |
845 | 847 | #else |
846 | 848 | return PNG_STRING_NEWLINE \ |
847 | | - "libpng version 1.6.47" PNG_STRING_NEWLINE \ |
| 849 | + "libpng version 1.6.51" PNG_STRING_NEWLINE \ |
848 | 850 | "Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \ |
849 | 851 | "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ |
850 | 852 | PNG_STRING_NEWLINE \ |
@@ -1520,7 +1522,7 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy) |
1520 | 1522 | } |
1521 | 1523 | #endif /* COLORSPACE */ |
1522 | 1524 |
|
1523 | | -#ifdef PNG_iCCP_SUPPORTED |
| 1525 | +#ifdef PNG_READ_iCCP_SUPPORTED |
1524 | 1526 | /* Error message generation */ |
1525 | 1527 | static char |
1526 | 1528 | png_icc_tag_char(png_uint_32 byte) |
@@ -1596,9 +1598,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_const_charp name, |
1596 | 1598 |
|
1597 | 1599 | return 0; |
1598 | 1600 | } |
1599 | | -#endif /* iCCP */ |
1600 | 1601 |
|
1601 | | -#ifdef PNG_READ_iCCP_SUPPORTED |
1602 | 1602 | /* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value |
1603 | 1603 | * is XYZ(0.9642,1.0,0.8249), which scales to: |
1604 | 1604 | * |
@@ -3998,7 +3998,7 @@ png_image_free_function(png_voidp argument) |
3998 | 3998 | # ifdef PNG_STDIO_SUPPORTED |
3999 | 3999 | if (cp->owned_file != 0) |
4000 | 4000 | { |
4001 | | - FILE *fp = png_voidcast(FILE*, cp->png_ptr->io_ptr); |
| 4001 | + FILE *fp = png_voidcast(FILE *, cp->png_ptr->io_ptr); |
4002 | 4002 | cp->owned_file = 0; |
4003 | 4003 |
|
4004 | 4004 | /* Ignore errors here. */ |
|
0 commit comments