Skip to content

Update libpng to 1.6.50 #4277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions Client/core/CFileFormatPng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "StdInc.h"
#include <libpng/png.h>
#include <libpng/pngpriv.h>

///////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -112,7 +111,15 @@ void ParseRGB(CBuffer& outImage, const png_structp& png_ptr, const png_infop& in
///////////////////////////////////////////////////////////////
void ReadDataFromInputStream(png_structp png_ptr, png_bytep outBytes, png_size_t byteCountToRead)
{
CBufferReadStream& stream = *(CBufferReadStream*)png_ptr->io_ptr;
if (!png_ptr)
return;

void* ioPtr = png_get_io_ptr(png_ptr);

if (!ioPtr)
return;

CBufferReadStream& stream = *(CBufferReadStream*)ioPtr;
stream.ReadBytes((byte*)outBytes, (size_t)byteCountToRead);
}

Expand Down Expand Up @@ -215,13 +222,19 @@ bool PngDecode(const void* pData, uint uiDataSize, CBuffer* pOutBuffer, uint& ui
///////////////////////////////////////////////////////////////
void my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
CBufferWriteStream* pStream = (CBufferWriteStream*)png_ptr->io_ptr;
if (!png_ptr)
return;

void* io_ptr = png_get_io_ptr(png_ptr);

if (!pStream)
if (!io_ptr)
return;
pStream->WriteBytes(data, length);

CBufferWriteStream* stream = (CBufferWriteStream*)io_ptr;
stream->WriteBytes(data, length);
}


///////////////////////////////////////////////////////////////
//
// PngEncode
Expand Down
10 changes: 5 additions & 5 deletions vendor/libpng/.cmake-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ disabled_codes: [
# re-enable the "invalid variable name XXX" messages.
"C0103",

# A custom command with one output doesn't really need a comment because
# the default "generating XXX" is a good message already.
# TODO:
# Add brief COMMENT arguments to the `add_custom_target` commands.
"C0113",
]

Expand Down Expand Up @@ -82,10 +82,10 @@ keyword_pattern: "[A-Z][0-9A-Z_]+"
# before considering the loop a parser
max_conditionals_custom_parser: 2

# Require at least this many newlines between statements
# Require at least this many newlines between statements;
# require no more than this many newlines between statements;
# etc.
min_statement_spacing: 1

# Require no more than this many newlines between statements
max_statement_spacing: 2
max_returns: 6
max_branches: 12
Expand Down
50 changes: 2 additions & 48 deletions vendor/libpng/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,55 +1,9 @@
# https://editorconfig.org

root = true
root = false

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[*.txt]
indent_size = unset
indent_style = space

[*.[chS]]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 80

[*.dfa]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 80

[*.awk]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 100

[*.cmake]
indent_size = 2
indent_style = space
max_doc_length = 80
max_line_length = 100

[*.sh]
indent_size = 4
indent_style = space
max_doc_length = 100
max_line_length = 100

[{Makefile.in,aclocal.m4,ltmain.sh}]
[*.[ch]]
indent_size = unset
indent_style = unset
insert_final_newline = unset
max_doc_length = unset
max_line_length = unset
trim_trailing_whitespace = unset

[COMMIT_EDITMSG]
indent_style = space
max_doc_length = unset
max_line_length = 72
2 changes: 2 additions & 0 deletions vendor/libpng/.github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
restore-keys: ${{ runner.os }}-pip-
- name: Install yamllint
run: pip install yamllint
- name: Install editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main
- name: Check out the code
uses: actions/checkout@v4
- name: Run the linting script
Expand Down
25 changes: 15 additions & 10 deletions vendor/libpng/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ ipch/
*.out
*out.png
[._]deps/
[._]libs/
.dirstamp
/Makefile
/autom4te.cache/
Expand All @@ -138,17 +139,21 @@ ipch/
CMake*.json
!CMakePresets.json
CMakeLists.txt.*
pnglibconf.[ch]
pnglibconf.dfn
pnglibconf.pre
pngprefix.h

# Libpng test programs
png-fix-itxt
pngcp
pngfix
pngimage
pngstest
pngtest
pngunknown
pngvalid
timepng
# Libpng test programs, scripts and artifacts
/test-suite.log
/tests/*.log
/tests/*.trs
/png-fix-itxt
/pngcp
/pngfix
/pngimage
/pngstest
/pngtest
/pngunknown
/pngvalid
/timepng
28 changes: 0 additions & 28 deletions vendor/libpng/.travis.yml

This file was deleted.

31 changes: 15 additions & 16 deletions vendor/libpng/ANNOUNCE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
libpng 1.6.47 - February 18, 2025
=================================
libpng 1.6.50 - July 1, 2025
============================

This is a public release of libpng, intended for use in production code.

Expand All @@ -9,13 +9,13 @@ Files available for download

Source files with LF line endings (for Unix/Linux):

* libpng-1.6.47.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.47.tar.gz (deflate-compressed)
* libpng-1.6.50.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.50.tar.gz (deflate-compressed)

Source files with CRLF line endings (for Windows):

* lpng1647.7z (LZMA-compressed, recommended)
* lpng1647.zip (deflate-compressed)
* lpng1650.7z (LZMA-compressed, recommended)
* lpng1650.zip (deflate-compressed)

Other information:

Expand All @@ -25,19 +25,18 @@ Other information:
* TRADEMARK.md


Changes from version 1.6.46 to version 1.6.47
Changes from version 1.6.49 to version 1.6.50
---------------------------------------------

* Modified the behaviour of colorspace chunks in order to adhere
to the new precedence rules formulated in the latest draft of
the PNG Specification.
* Improved the detection of the RVV Extension on the RISC-V platform.
(Contributed by Filip Wasil)
* Replaced inline ASM with C intrinsics in the RVV code.
(Contributed by Filip Wasil)
* Fixed a decoder defect in which unknown chunks trailing IDAT, set
to go through the unknown chunk handler, incorrectly triggered
out-of-place IEND errors.
(Contributed by John Bowler)
* Fixed a latent bug in `png_write_iCCP`.
This would have been a read-beyond-end-of-malloc vulnerability,
introduced early in the libpng-1.6.0 development, yet (fortunately!)
it was inaccessible before the above-mentioned modification of the
colorspace precedence rules, due to pre-existing colorspace checks.
(Reported by Bob Friesenhahn; fixed by John Bowler)
* Fixed the CMake file for cross-platform builds that require `libm`.


Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Expand Down
6 changes: 5 additions & 1 deletion vendor/libpng/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Authors, for copyright and licensing purposes.
* Lucas Chollet
* Magnus Holmgren
* Mandar Sahastrabuddhe
* Manfred Schlaegl
* Mans Rullgard
* Matt Sarett
* Mike Klein
Expand All @@ -40,8 +41,9 @@ Authors, for copyright and licensing purposes.
- Zixu Wang (王子旭)
* Arm Holdings
- Richard Townsend
* Google Inc.
* Google LLC
- Dan Field
- Dragoș Tiselice
- Leon Scroggins III
- Matt Sarett
- Mike Klein
Expand All @@ -51,6 +53,8 @@ Authors, for copyright and licensing purposes.
- GuXiWei (顾希伟)
- JinBo (金波)
- ZhangLixia (张利霞)
* Samsung Group
- Filip Wasil

The build projects, the build scripts, the test scripts, and other
files in the "projects", "scripts" and "tests" directories, have
Expand Down
27 changes: 27 additions & 0 deletions vendor/libpng/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6251,6 +6251,33 @@ Version 1.6.47 [February 18, 2025]
colorspace precedence rules, due to pre-existing colorspace checks.
(Reported by Bob Friesenhahn; fixed by John Bowler)

Version 1.6.48 [April 30, 2025]
Fixed the floating-point version of the mDCv setter `png_set_mDCv`.
(Reported by Mohit Bakshi; fixed by John Bowler)
Added #error directives to discourage the inclusion of private
libpng implementation header files in PNG-supporting applications.
Added the CMake build option `PNG_LIBCONF_HEADER`, to be used as an
alternative to `DFA_XTRA`.
Removed the Travis CI configuration files, with heartfelt thanks for
their generous support of our project over the past five years!

Version 1.6.49 [June 12, 2025]
Added SIMD-optimized code for the RISC-V Vector Extension (RVV).
(Contributed by Manfred Schlaegl, Dragos Tiselice and Filip Wasil)
Added various fixes and improvements to the build scripts and to
the sample code.

Version 1.6.50 [July 1, 2025]
Improved the detection of the RVV Extension on the RISC-V platform.
(Contributed by Filip Wasil)
Replaced inline ASM with C intrinsics in the RVV code.
(Contributed by Filip Wasil)
Fixed a decoder defect in which unknown chunks trailing IDAT, set
to go through the unknown chunk handler, incorrectly triggered
out-of-place IEND errors.
(Contributed by John Bowler)
Fixed the CMake file for cross-platform builds that require `libm`.

Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
Expand Down
Loading
Loading