Skip to content

Commit 1abc475

Browse files
committed
chore(png): update bundled libpng 1.6.56 -> 1.6.57
Security update released upstream since the previous commit in this series. Source: https://github.com/pnggroup/libpng/releases/tag/v1.6.57
1 parent 1ea8676 commit 1abc475

8 files changed

Lines changed: 78 additions & 32 deletions

File tree

dependencies/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ are replaced with system-installed versions via `find_package()` or `-l` flags.
1616
| [utf8proc](utf8proc/) | 2.11.3 | MIT | Foundation (Unicode normalization) | Yes | https://github.com/JuliaStrings/utf8proc |
1717
| [expat](expat/) | 2.7.5 | MIT | XML (SAX/DOM parser) | Yes | https://github.com/libexpat/libexpat |
1818
| [sqlite3](sqlite3/) | 3.53.0 | Public Domain | Data/SQLite (embedded database) | Yes | https://www.sqlite.org |
19-
| [png](png/) | 1.6.56 | libpng License | PDF (PNG image support) | Yes | https://github.com/pnggroup/libpng |
19+
| [png](png/) | 1.6.57 | libpng License | PDF (PNG image support) | Yes | https://github.com/pnggroup/libpng |
2020
| [v8_double_conversion](v8_double_conversion/) | 3.4.0 | BSD-3-Clause | Foundation (float-to-string conversion) | No | https://github.com/google/double-conversion |
2121
| [pdjson](pdjson/) | n/a | Public Domain | JSON (streaming parser) | No | https://github.com/skeeto/pdjson |
2222
| [tessil](tessil/) | n/a | MIT | Foundation (insertion-order-preserving hash containers) | No | https://github.com/Tessil/ordered-map |

dependencies/png/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# libpng - PNG reference library
2-
# Version: 1.6.56
3-
# Source: https://github.com/pnggroup/libpng/releases/tag/v1.6.56
2+
# Version: 1.6.57
3+
# Source: https://github.com/pnggroup/libpng/releases/tag/v1.6.57
44

55
if(POCO_UNBUNDLED)
66
if (ENABLE_PDF)

dependencies/png/src/png.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "pngpriv.h"
1414

1515
/* Generate a compiler error if there is an old png.h in the search path. */
16-
typedef png_libpng_version_1_6_56 Your_png_h_is_not_version_1_6_56;
16+
typedef png_libpng_version_1_6_57 Your_png_h_is_not_version_1_6_57;
1717

1818
/* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the
1919
* corresponding macro definitions. This causes a compile time failure if
@@ -820,7 +820,7 @@ png_get_copyright(png_const_structrp png_ptr)
820820
return PNG_STRING_COPYRIGHT
821821
#else
822822
return PNG_STRING_NEWLINE \
823-
"libpng version 1.6.56" PNG_STRING_NEWLINE \
823+
"libpng version 1.6.57" PNG_STRING_NEWLINE \
824824
"Copyright (c) 2018-2026 Cosmin Truta" PNG_STRING_NEWLINE \
825825
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
826826
PNG_STRING_NEWLINE \

dependencies/png/src/png.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* png.h - header file for PNG reference library
22
*
3-
* libpng version 1.6.56
3+
* libpng version 1.6.57
44
*
55
* Copyright (c) 2018-2026 Cosmin Truta
66
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
@@ -14,7 +14,7 @@
1414
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
1515
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
1616
* Glenn Randers-Pehrson
17-
* libpng versions 1.6.36, December 2018, through 1.6.56, March 2026:
17+
* libpng versions 1.6.36, December 2018, through 1.6.57, April 2026:
1818
* Cosmin Truta
1919
* See also "Contributing Authors", below.
2020
*/
@@ -238,7 +238,7 @@
238238
* ...
239239
* 1.5.30 15 10530 15.so.15.30[.0]
240240
* ...
241-
* 1.6.56 16 10656 16.so.16.56[.0]
241+
* 1.6.57 16 10657 16.so.16.57[.0]
242242
*
243243
* Henceforth the source version will match the shared-library major and
244244
* minor numbers; the shared-library major version number will be used for
@@ -274,7 +274,7 @@
274274
*/
275275

276276
/* Version information for png.h - this should match the version in png.c */
277-
#define PNG_LIBPNG_VER_STRING "1.6.56"
277+
#define PNG_LIBPNG_VER_STRING "1.6.57"
278278
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
279279

280280
/* The versions of shared library builds should stay in sync, going forward */
@@ -285,7 +285,7 @@
285285
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
286286
#define PNG_LIBPNG_VER_MAJOR 1
287287
#define PNG_LIBPNG_VER_MINOR 6
288-
#define PNG_LIBPNG_VER_RELEASE 56
288+
#define PNG_LIBPNG_VER_RELEASE 57
289289

290290
/* This should be zero for a public release, or non-zero for a
291291
* development version.
@@ -316,7 +316,7 @@
316316
* From version 1.0.1 it is:
317317
* XXYYZZ, where XX=major, YY=minor, ZZ=release
318318
*/
319-
#define PNG_LIBPNG_VER 10656 /* 1.6.56 */
319+
#define PNG_LIBPNG_VER 10657 /* 1.6.57 */
320320

321321
/* Library configuration: these options cannot be changed after
322322
* the library has been built.
@@ -426,7 +426,7 @@ extern "C" {
426426
/* This triggers a compiler error in png.c, if png.c and png.h
427427
* do not agree upon the version number.
428428
*/
429-
typedef char *png_libpng_version_1_6_56;
429+
typedef char *png_libpng_version_1_6_57;
430430

431431
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
432432
*

dependencies/png/src/pngconf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* pngconf.h - machine-configurable file for libpng
22
*
3-
* libpng version 1.6.56
3+
* libpng version 1.6.57
44
*
55
* Copyright (c) 2018-2026 Cosmin Truta
66
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson

dependencies/png/src/pngrtran.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
23792379
}
23802380
row_info->bit_depth = 8;
23812381
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
2382-
row_info->rowbytes = row_width * row_info->channels;
2382+
row_info->rowbytes = (size_t)row_width * row_info->channels;
23832383
}
23842384
}
23852385
#endif
@@ -2581,7 +2581,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
25812581

25822582
row_info->bit_depth = 8;
25832583
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
2584-
row_info->rowbytes = row_info->width * row_info->channels;
2584+
row_info->rowbytes = (size_t)row_info->width * row_info->channels;
25852585
}
25862586
}
25872587
#endif
@@ -2609,7 +2609,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
26092609

26102610
row_info->bit_depth = 8;
26112611
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
2612-
row_info->rowbytes = row_info->width * row_info->channels;
2612+
row_info->rowbytes = (size_t)row_info->width * row_info->channels;
26132613
}
26142614
}
26152615
#endif
@@ -2845,7 +2845,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
28452845
*(--dp) = lo_filler;
28462846
row_info->channels = 2;
28472847
row_info->pixel_depth = 16;
2848-
row_info->rowbytes = row_width * 2;
2848+
row_info->rowbytes = (size_t)row_width * 2;
28492849
}
28502850

28512851
else
@@ -2860,7 +2860,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
28602860
}
28612861
row_info->channels = 2;
28622862
row_info->pixel_depth = 16;
2863-
row_info->rowbytes = row_width * 2;
2863+
row_info->rowbytes = (size_t)row_width * 2;
28642864
}
28652865
}
28662866

@@ -2883,7 +2883,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
28832883
*(--dp) = hi_filler;
28842884
row_info->channels = 2;
28852885
row_info->pixel_depth = 32;
2886-
row_info->rowbytes = row_width * 4;
2886+
row_info->rowbytes = (size_t)row_width * 4;
28872887
}
28882888

28892889
else
@@ -2900,7 +2900,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
29002900
}
29012901
row_info->channels = 2;
29022902
row_info->pixel_depth = 32;
2903-
row_info->rowbytes = row_width * 4;
2903+
row_info->rowbytes = (size_t)row_width * 4;
29042904
}
29052905
}
29062906
#endif
@@ -2924,7 +2924,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
29242924
*(--dp) = lo_filler;
29252925
row_info->channels = 4;
29262926
row_info->pixel_depth = 32;
2927-
row_info->rowbytes = row_width * 4;
2927+
row_info->rowbytes = (size_t)row_width * 4;
29282928
}
29292929

29302930
else
@@ -2941,7 +2941,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
29412941
}
29422942
row_info->channels = 4;
29432943
row_info->pixel_depth = 32;
2944-
row_info->rowbytes = row_width * 4;
2944+
row_info->rowbytes = (size_t)row_width * 4;
29452945
}
29462946
}
29472947

@@ -2968,7 +2968,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
29682968
*(--dp) = hi_filler;
29692969
row_info->channels = 4;
29702970
row_info->pixel_depth = 64;
2971-
row_info->rowbytes = row_width * 8;
2971+
row_info->rowbytes = (size_t)row_width * 8;
29722972
}
29732973

29742974
else
@@ -2990,7 +2990,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
29902990

29912991
row_info->channels = 4;
29922992
row_info->pixel_depth = 64;
2993-
row_info->rowbytes = row_width * 8;
2993+
row_info->rowbytes = (size_t)row_width * 8;
29942994
}
29952995
}
29962996
#endif
@@ -4484,15 +4484,15 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
44844484
}
44854485
row_info->bit_depth = 8;
44864486
row_info->pixel_depth = 32;
4487-
row_info->rowbytes = row_width * 4;
4487+
row_info->rowbytes = (size_t)row_width * 4;
44884488
row_info->color_type = 6;
44894489
row_info->channels = 4;
44904490
}
44914491

44924492
else
44934493
{
44944494
sp = row + (size_t)row_width - 1;
4495-
dp = row + (size_t)(row_width * 3) - 1;
4495+
dp = row + (size_t)row_width * 3 - 1;
44964496
i = 0;
44974497
#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
44984498
i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row,
@@ -4511,7 +4511,7 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
45114511

45124512
row_info->bit_depth = 8;
45134513
row_info->pixel_depth = 24;
4514-
row_info->rowbytes = row_width * 3;
4514+
row_info->rowbytes = (size_t)row_width * 3;
45154515
row_info->color_type = 2;
45164516
row_info->channels = 3;
45174517
}

dependencies/png/src/pngset.c

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ void PNGAPI
385385
png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
386386
png_const_uint_16p hist)
387387
{
388+
png_uint_16 safe_hist[PNG_MAX_PALETTE_LENGTH];
388389
int i;
389390

390391
png_debug1(1, "in %s storage function", "hIST");
@@ -401,6 +402,13 @@ png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
401402
return;
402403
}
403404

405+
/* Snapshot the caller's hist before freeing, in case it points to
406+
* info_ptr->hist (getter-to-setter aliasing).
407+
*/
408+
memcpy(safe_hist, hist, (unsigned int)info_ptr->num_palette *
409+
(sizeof (png_uint_16)));
410+
hist = safe_hist;
411+
404412
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
405413

406414
/* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
@@ -742,7 +750,7 @@ void PNGAPI
742750
png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
743751
png_const_colorp palette, int num_palette)
744752
{
745-
753+
png_color safe_palette[PNG_MAX_PALETTE_LENGTH];
746754
png_uint_32 max_palette_length;
747755

748756
png_debug1(1, "in %s storage function", "PLTE");
@@ -776,6 +784,15 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
776784
png_error(png_ptr, "Invalid palette");
777785
}
778786

787+
/* Snapshot the caller's palette before freeing, in case it points to
788+
* info_ptr->palette (getter-to-setter aliasing).
789+
*/
790+
if (num_palette > 0)
791+
memcpy(safe_palette, palette, (unsigned int)num_palette *
792+
(sizeof (png_color)));
793+
794+
palette = safe_palette;
795+
779796
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
780797

781798
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
@@ -937,6 +954,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
937954
png_const_textp text_ptr, int num_text)
938955
{
939956
int i;
957+
png_textp old_text = NULL;
940958

941959
png_debug1(1, "in text storage function, chunk typeid = 0x%lx",
942960
png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name);
@@ -984,7 +1002,10 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
9841002
return 1;
9851003
}
9861004

987-
png_free(png_ptr, info_ptr->text);
1005+
/* Defer freeing the old array until after the copy loop below,
1006+
* in case text_ptr aliases info_ptr->text (getter-to-setter).
1007+
*/
1008+
old_text = info_ptr->text;
9881009

9891010
info_ptr->text = new_text;
9901011
info_ptr->free_me |= PNG_FREE_TEXT;
@@ -1069,6 +1090,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
10691090
{
10701091
png_chunk_report(png_ptr, "text chunk: out of memory",
10711092
PNG_CHUNK_WRITE_ERROR);
1093+
png_free(png_ptr, old_text);
10721094

10731095
return 1;
10741096
}
@@ -1122,6 +1144,8 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
11221144
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
11231145
}
11241146

1147+
png_free(png_ptr, old_text);
1148+
11251149
return 0;
11261150
}
11271151
#endif
@@ -1165,6 +1189,16 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
11651189

11661190
if (trans_alpha != NULL)
11671191
{
1192+
/* Snapshot the caller's trans_alpha before freeing, in case it
1193+
* points to info_ptr->trans_alpha (getter-to-setter aliasing).
1194+
*/
1195+
png_byte safe_trans[PNG_MAX_PALETTE_LENGTH];
1196+
1197+
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
1198+
memcpy(safe_trans, trans_alpha, (size_t)num_trans);
1199+
1200+
trans_alpha = safe_trans;
1201+
11681202
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
11691203

11701204
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
@@ -1249,6 +1283,7 @@ png_set_sPLT(png_const_structrp png_ptr,
12491283
*/
12501284
{
12511285
png_sPLT_tp np;
1286+
png_sPLT_tp old_spalettes;
12521287

12531288
png_debug1(1, "in %s storage function", "sPLT");
12541289

@@ -1269,7 +1304,10 @@ png_set_sPLT(png_const_structrp png_ptr,
12691304
return;
12701305
}
12711306

1272-
png_free(png_ptr, info_ptr->splt_palettes);
1307+
/* Defer freeing the old array until after the copy loop below,
1308+
* in case entries aliases info_ptr->splt_palettes (getter-to-setter).
1309+
*/
1310+
old_spalettes = info_ptr->splt_palettes;
12731311

12741312
info_ptr->splt_palettes = np;
12751313
info_ptr->free_me |= PNG_FREE_SPLT;
@@ -1333,6 +1371,8 @@ png_set_sPLT(png_const_structrp png_ptr,
13331371
}
13341372
while (--nentries);
13351373

1374+
png_free(png_ptr, old_spalettes);
1375+
13361376
if (nentries > 0)
13371377
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
13381378
}
@@ -1381,6 +1421,7 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
13811421
png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
13821422
{
13831423
png_unknown_chunkp np;
1424+
png_unknown_chunkp old_unknowns;
13841425

13851426
if (png_ptr == NULL || info_ptr == NULL || num_unknowns <= 0 ||
13861427
unknowns == NULL)
@@ -1427,7 +1468,10 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
14271468
return;
14281469
}
14291470

1430-
png_free(png_ptr, info_ptr->unknown_chunks);
1471+
/* Defer freeing the old array until after the copy loop below,
1472+
* in case unknowns aliases info_ptr->unknown_chunks (getter-to-setter).
1473+
*/
1474+
old_unknowns = info_ptr->unknown_chunks;
14311475

14321476
info_ptr->unknown_chunks = np; /* safe because it is initialized */
14331477
info_ptr->free_me |= PNG_FREE_UNKN;
@@ -1473,6 +1517,8 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
14731517
++np;
14741518
++(info_ptr->unknown_chunks_num);
14751519
}
1520+
1521+
png_free(png_ptr, old_unknowns);
14761522
}
14771523

14781524
void PNGAPI

dependencies/png/src/pngtest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#define STDERR stdout
5151

5252
/* Generate a compiler error if there is an old png.h in the search path. */
53-
typedef png_libpng_version_1_6_56 Your_png_h_is_not_version_1_6_56;
53+
typedef png_libpng_version_1_6_57 Your_png_h_is_not_version_1_6_57;
5454

5555
/* Ensure that all version numbers in png.h are consistent with one another. */
5656
#if (PNG_LIBPNG_VER != PNG_LIBPNG_VER_MAJOR * 10000 + \

0 commit comments

Comments
 (0)