Branch


Log

Author Commit Date CI Message
Thomas de Grivel 40f9201b 2025-10-25T12:05:35 fix autogen.sh
Tobias Stoeckmann bd41aa64 2025-09-29T22:06:04 api! Remove the experimental (and incomplete) ERROR_NUMBERS code The purpose of this feature is to optionally prepend standardized numbers to error and warning messages. The ERROR_NUMBERS feature was first drafted in libpng-1.2.0 and further developed in libpng-1.4.0; and yet, it was always disabled by default, and never completed. In the light of a recent report concerning the security hazards arising from enabling this code in custom libpng builds, we think it's best to simply remove all the code written to support this feature. Based on removal in libpng18, but keeping functions and options as no-ops for backwards compatibility. Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta c6913e22 2025-09-29T14:38:59 chore: Update .gitignore to exclude local coding agent files This is a cherry-pick of commit 8cfbbab55715674d7ea7f123707806f8b44228ab from branch 'libpng18'.
Cosmin Truta 99230a03 2025-09-03T21:18:33 refactor: Delete conditional compilation for libpng 1.6.0 or earlier This is a cherry-pick of commit 5ff29c03bbe19992dcfe173a8db8528b4317ae4b from branch 'libpng18'
Cosmin Truta 27de46c5 2025-09-01T16:50:02 ci: Run autogen.sh without `--maintainer` in ci_verify_configure.sh The autogen.sh script is not user-serviceable in the 'libpng16' branch, which implies the following: - It requires the `--maintainer` option. - It should not be run by the CI tooling. Starting from the branch 'libpng18' onwards, the autogen.sh script becomes not only user-serviceable, but also mandatory, which implies: - It should be run by the CI tooling. - It does not require the `--maintainer` option. Removing the option `--maintainer` from ci_verify_configure.sh should not only simplify the verification script, but also catch errors that might occur in the above-mentioned scenarios. This is a cherry-pick of commit 2cd45a9728fa054ccf17e4cac5a9dd77f46251a0 from branch 'libpng18'.
Cosmin Truta e4e25f2e 2025-09-01T16:44:51 ci: Add GitHub Actions for verifying libpng on Linux, macOS and Windows This is a cherry-pick of commit 03f83b88c16605d670dff6070956a47b116e0787 from branch 'libpng18'.
Cosmin Truta 134ab615 2025-07-17T23:00:16 chore: Update .gitignore This is a cherry-pick of commit c14037646e4f61a7a6cc65c96cf9c3188af25022 from branch 'develop'.
Cosmin Truta 8fb19f2e 2025-07-14T22:05:50 doc: Update and reorganize the png.5 man page This is a cherry-pick of commit 929ad805c5aa15321e8236897a8b0225607d3182 from branch 'develop'. Co-authored-by: Chris Lilley <chris@w3.org>
Filip Wasil 816b008d 2025-07-08T09:48:51 riscv: Leverage `__riscv_v` in pngpriv.h Reviewed-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil 7916eb7b 2025-07-07T11:08:35 riscv: Support only RVV 1.0 Reviewed-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 7cecdcae 2025-07-03T22:42:11 Harden a vestigial check against overflow inside `png_zalloc` Reported-by: Sergio Atienza Pastor, MTP Métodos y Tecnología
Cosmin Truta cf59edd3 2025-07-02T20:24:24 Bump version to 1.6.51.git
Cosmin Truta 2b978915 2025-07-01T23:50:00 Release libpng version 1.6.50
Cosmin Truta 254a64ec 2025-07-01T22:57:36 doc: Update the man pages to the final PNG-3 specification Also make editorial changes regarding the previous PNG specifications.
Cosmin Truta 9eb25bd8 2025-06-30T23:46:32 chore: Rerun `./autogen.sh --maintainer`
Cosmin Truta 8087a21d 2025-06-30T22:27:17 build: Fix the CMake file for cross-platform builds that require `libm` Detect the availability of `libm` on the target platform. Previously, `libm` was detected on the host platform only. Also introduce the variable `PNG_LINK_LIBRARIES`. Stop using `M_LIBRARY`, which was not namespace-clean.
John Bowler 2e5f296b 2025-06-24T14:18:37 fix: Prevent unknown chunks from causing out-of-place IEND errors PNG_AFTER_IDAT was not set by the IDAT read code if unknown chunk handling was turned on. This was hidden in the current tests by checks within the text handling chunks. (For example, pngtest.png has a zTXt chunk after IDAT.) This change modifies both the sequential and the progressive reader to reliably set PNG_AFTER_IDAT when the first non-IDAT chunk is seen and before that chunk is processed. The change is minimalist; PNG_HAVE_CHUNK_AFTER_IDAT can probably be removed and replaced with PNG_AFTER_IDAT. Making the latter change is something to be considered in libpng2. Co-authored-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil 4266c75f 2025-06-28T12:00:03 riscv: Remove unused argument Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil f451a4de 2025-06-27T13:00:56 riscv: Simplify the runtime check to always be present Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil 6aa47deb 2025-06-26T13:32:49 riscv: Do not overwrite `-march` when testing against SIMD availability Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil 3391bb98 2025-06-26T11:54:29 riscv: Use C intrinsics Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil 21895b05 2025-06-17T14:08:17 riscv: Clearly separate the build flow for autotools and cmake Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta be81ebe1 2025-06-17T11:41:32 chore: Rerun `./autogen.sh --maintainer`
Filip Wasil edf46621 2025-06-17T08:36:53 riscv: Improve the RVV availability check In some cases, the vector extension is not supported, although the compiler allows the "v" flag in `-march` and includes `<riscv_vector>` without raising an error. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 5dc5937b 2025-06-14T18:29:05 chore: Update .gitignore This is a cherry-pick of commit df3b9173277aae60b08a216dc23484f6ec171ef5 from branch 'libpng18'.
Cosmin Truta 7084241c 2025-06-14T17:13:02 Bump version to 1.6.50.git
Cosmin Truta 64020428 2025-06-12T20:05:46 Release libpng version 1.6.49
Cosmin Truta 740366c3 2025-06-12T19:58:06 doc: Update the png.5 man page to the latest PNG-3 draft
Cosmin Truta 5d53dfd2 2025-06-12T18:46:04 chore: Rerun `./autogen.sh --maintainer`
Filip Wasil 5b62726c 2025-06-12T12:58:51 riscv: Fix autodetection of RVV support Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta a5830bfc 2025-06-11T21:38:01 build: Fix the detection of the math library in the CMake file This is a fix of commit 5631b9b952e6940c67d4b48c00882e99229aa31b "build: Implement various improvements to the CMake file"
Cosmin Truta 3bca02e2 2025-06-01T22:40:38 examples: Refactor and reformat using clang-format Add contrib/examples/.clang-format, tailored to fit the existing code as closely as possible. The end goal is to set up automatic formatting for the entire libpng source tree. We're doing this experiment in this subdirectory, for now. Also make refactoring changes, as follows: * Rewrite the preprocessor checks `#if PNG_FOO_SUPPORTED` to stop compilation immediately, with a descriptive `#error` about what needs to be supported. * Rewrite and reflow comments, add braces and brackets, and make other minor modifications that are suited for the clang-format'ed code.
Sanjay Jangid 197bbfe0 2025-05-31T16:41:42 examples: Fix file descriptor leak in iccfrompng.c by closing input file Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 0cc6436e 2025-05-29T22:55:00 build: Repair and reduce the CMake build dependency graph A funny thing happened while refactoring the function argument parsing in the `PNGGenConfig` module: the processing of dependencies inside the CMake function `generate_copy` got fixed, thanks to an inadvertent typo correction! Going down the rabbit hole, we uncovered two issues: 1. A typo in `scripts/cmake/PNGGenConfig.cmake` caused a dependency declaration to disappear, disrupting the graph. Fortunately, this disruption was being mitigated by an additional set of (redundant) symbolic target declarations that kept the CMake build going. 2. The exact string matching inside `scripts/cmake/gensrc.cmake.in` imposed an artificial limitation, disallowing the use of absolute file paths. The typo correction in (1), and the use of regex matching instead of exact string matching in (2), allowed us to use absolute file paths in the main CMake file, consistently, thus allowing CMake to recognize them as uniquely-identifiable nodes in the dependency graph. There should be no further need to have extra symbolic targets for proper node identification. In the end, we shaved off the redundant symbolic target declarations, retaining only `png_genfiles` and `png_genprebuilt`.
Cosmin Truta f04c457a 2025-05-29T19:47:03 build: Remove the PNG_DEBUG option from CMake files and project files Counter-intuitively, defining the PNG_DEBUG macro as 1 (i.e. setting the debug verbosity level to 1) does *not* cause any of the existing debug traces to show up. This setting would have worked if we had trace statements like `png_debug(0, message)`, but we don't have any. Debug traces do show up for verbosity levels from 2 to 5. The libpng manual describes in detail how they are meant to be used. According to the history of the CMake file, as well as the history of other project files, PNG_DEBUG was never set to a numeric value larger than 1. In other words, these debug settings inside these build files never produced any output in any (unmodified) libpng version. (As for the configure build, PNG_DEBUG has no special treatment there.) Considering the plethora of alternative methods to pass C preprocessor options through our build files, scripts and projects onto libpng, we'd rather discontinue PNG_DEBUG as a dedicated build option.
Cosmin Truta 5631b9b9 2025-05-29T18:28:16 build: Implement various improvements to the CMake file Allow the CMake build to work properly, even if file paths (in the source directory, in the build directory, or in the install directory) might contain whitespace characters. Improve the check for compilers that might use MSVC Runtime library headers on Windows. We use POSIX-ish ("deprecated") functions, even on Windows, and we want no spurious warnings. Tidy up the CMake file: rearrange declarations, rewrite comments, etc.
Joost Nieuwenhuijse dc71f481 2025-02-26T22:17:08 build: Fix apple-non-apple cross building When cross compiling for an apple platform on a non-apple platform (or the reverse), `if(APPLE)` in line 32 should refer to the target platform. Without importing the `APPLE` variable, it refers to the host platform. Reviewed-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta e2c15798 2025-05-28T10:55:24 ci: Add action-editorconfig-checker to the GitHub Action for linting The editorconfig-checker program is not installed by default in the OS used by GitHub Actions. Fortunately, the editorconfig-checker authors have kindly provided the action-editorconfig-checker repository, which we are now using.
Cosmin Truta cff86202 2025-05-27T11:28:56 chore: Add riscv/.editorconfig and pacify editorconfig-checker Also tidy up the new RISC-V code to comply with our coding style, and rearrange comments inside png.h to improve readability within the configured editing limits.
Cosmin Truta 5be32eb3 2025-05-26T22:37:06 chore: Rerun `./autogen.sh --maintainer`
Filip Wasil 611bf101 2025-05-19T12:44:35 riscv: autotools update
Filip Wasil 0e37c0b4 2025-05-14T19:30:39 riscv: Fix more comments Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil 71088434 2025-05-08T15:39:32 riscv: Fix the run-time checking of the RVV availability Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil 2b0eb786 2025-05-05T15:47:38 riscv: Fix autotools definitions and comments Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Filip Wasil ffb8e8b2 2025-03-11T13:07:00 Fix and improve the RISC-V Vector (RVV) implementation Changes include manually merged code from Manfred SCHLAEGL. Co-authored-by: Manfred SCHLAEGL <manfred.schlaegl@gmx.at> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Dragoș Tiselice cc5ee6b2 2023-05-02T10:36:08 Add optimized RISC-V Vector functions Largely based off of the ARM NEON implementation. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta b4800bae 2025-05-01T14:50:23 Bump version to 1.6.49.git
Cosmin Truta ea127968 2025-04-30T16:51:46 Release libpng version 1.6.48
Cosmin Truta 643dbda7 2025-04-30T16:30:24 doc: Update the png.5 man page to the latest PNG-3 draft specification Also update libpngpf.3 to explicitly state that the internal functions should not be used by applications.
Cosmin Truta 34e3f7a6 2025-04-30T11:49:37 Remove the config for Travis CI (and thank them for their support!) Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 3e675310 2025-04-29T17:30:30 chore: Add a TODO note in .cmake-format.yaml; reformat CMakeLists.txt Apply some (but not all) of the suggestions made by the cmake-format program. Meanwhile, the cmake-lint program is (still) happy.
Cosmin Truta 23bdc7a6 2025-04-28T20:44:53 build: Add the CMake build option `PNG_LIBCONF_HEADER` Running the pnglibconf scripts (script/*.awk) is not always possible. An AWK interpreter is not always guaranteed to be available; and even if it is, there are limitations when making cross-platform libpng builds, especially when the differences between the host platform and the target platform are significant. For example: * Building for the Windows (MinGW) target on a Unix development host; * Building for the iOS target on a macOS development host; * Building for the Android target on any development host. In such scenarios, a preconfigured (i.e. prebuilt) pnglibconf.h file, either taken from the libpng source tree or provided by the user who wants to make a custom libpng build, becomes a necessity. In this commit we introduce the build option `PNG_LIBCONF_HEADER` in order to address this specific use case. We also specify a version range (3.14...4.0) for the minimum required CMake program, to future-proof the CMake build for just a little bit longer. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 69a3e5bf 2025-04-25T16:19:30 chore: Clean up the error directives Make the error directives uniformly consistent with one another. Remove surrounding quotes and trailing punctuation, and rephrase some of the error messages and some of their associated comments for either brevity or clarity.
Cosmin Truta c9049172 2025-04-25T15:35:11 Discourage the inclusion of private headers outside libpng Add checks inside the private png*.h header files, in order to reduce unintentional occurences of application backdoors. Such backdoors might occur, for example, when we make changes to the internal data structures that might somehow "leak" from the libpng code into the user code. The applications that use the libpng API must pretend not to know that these headers exist at all. Co-authored-by: John Bowler <jbowler@acm.org> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
John Bowler 98448e37 2025-04-19T08:59:35 Remove unused function from write-only configurations `png_icc_profile_error` is no longer used when writing iCCP chunks, therefore it can be compiled out when the reading is disabled. This change includes two `minconfig` files to test read-only and write-only "full" configurations, to supplement the existing tests for "minimal" configurations. Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
John Bowler f2b0f5fe 2025-04-19T08:58:09 fix(mDCv): Correct the floating-point setter `png_set_mDCv` In the floating-point API function `png_set_mDCv` we incorrectly divided by two the chromaticity values before passing them on to `png_set_mDCv_fixed`. Reported-by: Mohit Bakshi <mohitbakshi2205@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Chris Blume 7101a556 2025-04-08T08:08:20 Correct mistake in example.c
Cosmin Truta e046c0dc 2025-04-22T16:39:01 Revert "Recover from errors in ancillary chunks" This reverts commit 34005e3d3d373c0c36898cc55eae48a79c8238a1. Although I agreed with Lucas Chollet initially, I finally understood the objection brought forth by John Bowler: "[...] it's not an ancillary chunk type if it's not a chunk type in the first place." I feel that more deliberation is needed on what a robust PNG decoder should do when it stumbles upon a chunk type that fails to meet its basic requirements. A clarifying recommendation for decoders may or may not need to be stipulated in the PNG specification as well. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Lucas CHOLLET 34005e3d 2025-03-03T15:06:40 Recover from errors in ancillary chunks As per the third edition of the spec, decoders should recover from errors in ancillary chunks. In section 13.1 Error handling [1]: > Anomalous situations other than syntax errors shall be treated as > follows: > 1. Encountering an unknown ancillary chunk is never an error. The > chunk can simply be ignored. More specifically, in this commit, if a chunk that is detected as ancillary, does not pass the `check_chunk_name()` function, only a _benign_ is issued, instead of an error. This allows libpng to fully decode images like [2] and [3]. It has been tested by passing them to both pngtest and Gnome's image viewer. Note that invalid-unknown-ancillary-after-IDAT.png could already be displayed but not fully decoded. [1] https://w3c.github.io/png/#13Decoders.Errors [2] https://github.com/web-platform-tests/wpt/blob/master/png/errors/support/invalid-unknown-ancillary.png [3] https://github.com/web-platform-tests/wpt/blob/master/png/errors/support/invalid-unknown-ancillary-after-IDAT.png
Cosmin Truta 44f97f08 2025-02-21T15:34:09 [libpng18] chore: Clean up the `FILE *` formulations in code and in documentation We should use `FILE *` instead of `FILE*` or `(FILE*)`, consistently, as we should for all other pointer types. Moreover, when we refer to standard stdio file objects in comments and in documentation, we should use the term "FILE objects" consistently. Lastly, we clarify in a comment in example.c that `PNG_STDIO_SUPPORTED` is true only when the stdio support is both available in the system and accessible in the user's libpng build. This is a cherry-pick of commit c63c5463903014c904b540216c2784023fb8c1c8 from branch 'libpng18'. Reviewed-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 044536de 2025-02-21T11:31:13 [libpng18] chore: Clean up remnants of the long-discontinued Win16 support Remove #ifdef sections and other workarounds for old Windows compilers that lacked proper support for Win32, including, especially, support for the Win32 stdio API. This is a cherry-pick of commit e936211760ddf0ed4a4711ea897b59395dfd206e from branch 'libpng18'. Reviewed-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 738f5e74 2025-02-20T11:59:16 ci: Add more checks to ci_verify_version.sh; refactor In addition to png.h, configure.ac and CMakeLists.txt, the script ci_verify_version.sh is now able to verify libpng-config-head.in also. For the benefit of readability, the old script ci_shellify.sh has been split into smaller, independent scriptlets: libexec/ci_shellify_*.sh. The linting script ci_lint.sh has been updated as needed.
Cosmin Truta f20e66aa 2025-02-19T13:15:14 chore: Apply some of the missed updates to the copyright year
Cosmin Truta 5d095014 2025-02-19T13:07:40 Bump version to 1.6.48.git
Cosmin Truta 872555f4 2025-02-18T11:18:30 Release libpng version 1.6.47
Cosmin Truta bb7e9229 2025-02-17T21:13:32 ci: Introduce the `CI_NO_BUILD` flag For testing purposes (e.g. wanting to see if "make distclean" works correctly with and without building), as well as development purposes (e.g. wanting to inspect the artifacts produced in the configuration stage), add `CI_NO_BUILD` to the family of contrarians.
John Bowler b20e6fb3 2025-02-13T13:00:49 pngimage: clean up on user/internal errors pngimage: The code simply exited with a return code of 99 in the event of a user error including giving pngimage invalid PNG files and an internal error. It now attempts to clean up the state before doing so, matching the normal behaviour. pngimage: Non-ISO use of setjmp(3) corrected. pngerror.c: Failure to call png_image_free on a false result from a png_safe_execute function call fixed. This was a regression caused by the 'volatile' clean-up. Not normally detectable because png_image_free will often be called by the application. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Chris Lilley 5356b941 2025-02-11T11:39:31 Update man page to latest PNG 3e draft
John Bowler 812c34c1 2025-01-31T09:46:21 test: add limit configuration tests nocompile-limits.dfa: turns off all limits including run-time limits nolimits.dfa: makes the compile time limits unlimited while leaving on the run-time limits. Fixes compiler warnings exposed by these tests. These are just warnings, there were no bugs other than a failure to handle systems with a 16-bit at the appropriate time which would result in a later failure on malloc. png.c: png_icc_check_length: in-line code was still used in place of png_chunk_max when checking the current chunk allocation limit. The in-line code did not handle PNG_MAXSEG_64K and, anyway, issued compiler warnings in the 'nocompile-limits' case. Changed to use png_malloc_max. pngrutil.c: eliminated an erroneous 'truncation' warning with GCC-14 by using a safe cast. pngtest.c: failed to check for PNG_USER_LIMITS_SUPPORTED around API calls which don't exist without PNG_USER_LIMITS. Signed-off-by: John Bowler <jbowler@acm.org>
John Bowler 68e090e7 2025-01-29T18:42:22 fix: `png_write_iCCP` check on profile length This is a regression of commit a8242dd9473a8da4d851623cf0b514a8ee4bee34 "PNGv3 colourspace precedence rules conformance". Previously, `png_write_iCCP` used the length from the first four bytes of the profile set by `png_set_iCCP`, rather than the actual data length recorded by `png_set_iCCP`. If the profile data were less than 4 bytes long, it would have caused a read-beyond-end-of-malloc error. This bug was in the libpng code even before the changes introduced in the above-mentioned commit, but it was inaccessible. It became accessible when we removed the pre-PNGv3 colour space checks in `png_set_iCCP`. Reported-by: Bob Friesenhahn <bobjfriesenhahn@gmail.com> Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 8c7ed2e3 2025-01-30T23:07:55 fix: Typo in a preprocessor directive This is a regression of commit 2519a03418af2108d3bd8c269ba01ab72ae240ef "refactor: Clean up the checking of chunk lengths and allocation limits" Compilation would break under the "right" non-default configuration. (Oopsie!) Also clean up comments in the surrounding code. Reported-by: chris0e3 <chris0e3@gmail.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
John Bowler 2519a034 2025-01-28T18:55:47 refactor: Clean up the checking of chunk lengths and allocation limits Internal changes only. Move chunk length checks to fewer places: Change `png_struct::user_chunk_malloc_max` to always have a non-zero value, in order to avoid the need to check for zero in multiple places. Add `png_chunk_max(png_ptr)`, a function-like macro defined in pngpriv.h which expresses all the previous checks on the various USER_LIMITS and system limitations. Replace the code which implemented such checks with `png_chunk_max`. Move the malloc limit length check in `png_read_chunk_header` to `png_handle_chunk` and make it conditional on the chunk type. Progressive reader: call `png_read_chunk_header`. Correct the handling of pHYs. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
John Bowler c4b20d0a 2025-01-27T10:51:01 test: add configuration tests and fix bugs The two new configuation tests, fixed.dfa and float-fixed.dfa verify that the 'standard' configuration of libpng works without floating point arithmetic. Signed-off-by: John Bowler <jbowler@acm.org>
John Bowler a8242dd9 2025-01-26T14:42:02 PNGv3 colourspace precedence rules conformance This is a major change required by the new PNGv3 colour chunk precedence rules. It **does not** change the libpng API (png.h) however it changes the following handling of PNG files: IFF the PNG file contains colour space information it changes from the libpng v3 behaviour to the now compulsory PNG v3 behaviour: 1) libpng no longer invalidates colour space chunks because they are inconsistent. 2) libpng no longer responds to the "png_get_" APIs positively if they are not present in the PNG but can be deduced from the colour space chunks that are present.
Cosmin Truta 171bdd3a 2025-01-27T18:32:44 Bump version to 1.6.47.git
Cosmin Truta 0024abd2 2025-01-23T19:02:04 Release libpng version 1.6.46
Cosmin Truta fcb0bca1 2025-01-22T23:19:49 chore: Update the .editorconfig file; add/update README files Add various missing pieces to their right places: * Update .editorconfig in order to let editorconfig-checker know that aclocal.m4 (which is auto-generated) may contain trailing whitespace. * Add ci/README.md. * Update scripts/README.txt. TODO: Integrate editorconfig-checker into the linting workflow on GitHub. (See .github/workflows/lint.yml)
Cosmin Truta deadeea7 2025-01-22T15:15:58 chore: Fix a typo in Makefile.am; rerun `./autogen.sh --maintainer`
Cosmin Truta 9cc729b5 2025-01-21T19:06:43 build: Update scripts/makefile.* Apply the following updates: * Tidy up the compiler flag definitions. * Update the Darwin, Linux and MSYS makefiles to match the compiler flags used in scripts/makefile.clang and scripts/makefile.gcc. * Add the `pngtest-static` target in the Darwin makefile, following on the Linux makefile. * Rewrite some of the implicit make rules to match one another more consistently. * Make corrections in the copyright years to match git log.
Cosmin Truta 36a16fd7 2025-01-21T18:42:49 build: Add scripts/makefile.c89; update other makefiles Add scripts/makefile.c89 and refactor scripts/makefile.emcc, scripts/makefile.clang and scripts/makefile.gcc Refactor variable definitions inside scripts/makefile.clang, scripts/makefile.gcc and scripts/makefile.emcc, and start using the option `-pedantic-errors` unconditionally. This option was first implemented in GCC version 3.1, and it was available in Clang and in other Clang-based compilers (e.g. Emscripten) from the beginning. Add scripts/makefile.c89, derived from the above makefiles, but with `-pedantic-errors -std=c89`. We aren't enabling the C89 level by default, to avoid any incompatibility, whether intentional or accidental, with the compiler's default language level. However, we are still continuing to support C89 in the 'libpng16' branch, and this special makefile can be used for testing purposes.
John Bowler 4d7c9933 2025-01-19T21:13:08 fix: Restore the build for strictly-conforming standard compilers In libpng version 1.6.45 we inadvertently used a declaration after a statement, which works for compilers supporting C99 and newer, but fails with C89 compilers, which we are still supporting in the branch 'libpng16'. Moreover, in commit 92e8581f12d4570b777eaabfbe1f4243b7b80c04, we used the macro `PNG_FIXED_EXPORT` in a manner that introduced a spurious ';' character, which broke the build for all standard-conforming compilers. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 19a5a5eb 2025-01-10T14:49:51 pngminus: Remove a workaround for an old printer A downgrade from 16-bit samples to 8-bit samples, or an expansion from 1- or 2-channel grayscale (or grayscale+alpha) to 3- or 4-channel RGB (or RGB+alpha), etc., may be deemed generally useful. Such image transforms could be made available to the user via command-line options. On the other hand, keeping the decision to disable or enable these transforms unconditionally at compile time (e.g. because they're needed to work around a specific printer's limitations) is less than ideal.
Cosmin Truta 8a28d055 2025-01-10T13:21:21 pngminus: Fix a typo in png2pnm.c
Cosmin Truta 03660a51 2025-01-10T12:27:01 pngminus: Add .editorconfig file; update the CMake file
John Bowler f753baae 2025-01-04T00:10:47 api(PNGv3): Update the generated files and `PNG_EXPORT_LAST_ORDINAL` Apart from the png.h change, these files are machine-generated. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
John Bowler 92e8581f 2025-01-03T22:43:00 api(PNGv3): Add support for mDCV and cLLI This adds APIs to get/set the two remaining new PNG-v3 colour space chunks. The mDCV API matches that of cHRM. Both chunks support floating point APIs (all values in the two chunks are real numbers). Both chunks have a new encoded type, a four-digit-precision fixed-point number, which cannot be represented in the existing `png_fixed_point` type, so a `png_uint_32` is used. Test examples for cICP, cLLI and mDCV are now in pngtest.png, and a necessary change to the pngunknown.c test program has been made to accomodate the additions. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 8ffc967e 2025-01-08T19:26:11 Bump version to 1.6.46.git
Cosmin Truta 51f5bd68 2025-01-07T18:31:22 Release libpng version 1.6.45
Cosmin Truta 3714c584 2025-01-06T19:48:56 chore: Rerun `./autogen.sh --maintainer`
Cosmin Truta 2a845ff8 2025-01-06T17:09:10 build: Move portions from the main CMake file to separate modules In preparation for the upcoming changes in the build system, any parts of the CMake file that are unlikely to be affected should be moved out of the way. This should facilitate an easier resync between the branch 'libpng16' and its successor(s). Specifically: * Move the functions `generate_chk`, `generate_out`, `generate_source` and `generate_copy` to scripts/cmake/PNGGenConfig.cmake. * Move the function `png_add_test` to scripts/cmake/PNGTest.cmake. * Leave the function `create_symlink` in place, but add a TODO note. As we raised the minimum required CMake version to 3.14, we should now be able to use CMake's built-in function instead.
John Bowler 0cc367aa 2025-01-03T10:35:19 [libpng16] fix: Write order of colourspace chunks should conform to PNG v3 cICP was written after PLTE, not before. The other chunks were output in an order which does not match the new PNG-v3 "priority" order. This change outputs all chunks in the "priority" order; highest precedence first. This means that the PNGs so written conform to PNG v3 (cICP), and allow a streaming app to handle chunks in order, without buffering data which may later be overridden. Note that PNG-v3 establishes the idea of dropping ancillary chunks which are inconveniently ordered in the definition of how APNG chunks are handled. This is a cherry-pick of commit 945f2602a0ea05a7938b2f52df9ef16cf3440291 from branch 'libpng18'. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 3042f74d 2025-01-02T20:16:25 [libpng16] fix: Update the cICP implementation yet more For the sake of completeness: * Add the cICP entry to the list of known chunks to ignore inside `png_set_keep_unknown_chunks`. * Handle cICP in `png_read_end`, alongside cHRM, gAMA, iCCP, sRGB. * In pngtest.c, move the cICP test code near cHRM, gaMA, iCCP, sRGB. This is a cherry-pick of commit 27c2ac722fd99b8622cead655034208ce96346ac from branch 'libpng18'. Reviewed-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 4599354b 2024-10-06T19:11:22 [libpng16] test: Move cicp-display-p3_reencoded.png to contrib/testpngs/png-3/ Update the main CMake file and the auxiliary test scripts accordingly. This is a cherry-pick of commit fe277b7752990be35523832a546aec478437968a from branch 'libpng18'.
Cosmin Truta 823c2d80 2024-12-31T22:05:03 [libpng16] fix: Update the cICP support for better compliance with PNG-3 Apply the following corrections and improvements: * Add a validity check in `png_set_cICP`. * Fix the ordering check in `png_handle_cICP`. * Add a multiplicity check in `png_handle_cICP`. * Optimize the implementation of `png_write_cICP`. * Remove an unnecessary preprocessor guard from pngtest.c. * Update the dependency declaration in pnglibconf.dfa. * Fix the indentation where necessary. This is a cherry-pick of commit c2a02691df1ecf51b7c97142752a7034350cb1f6 from branch 'libpng18'.
Lucas CHOLLET 75748d93 2024-06-22T00:35:55 [libpng16] Add support for reading and writing the cICP chunk This chunk was added in the third edition of the PNG specification and contains Coding Independent Code Points (related to color space description). It is fairly simple as it only contains four fields of one byte each: Colour Primaries, Transfer Function, Matrix Coefficients, Video Full Range Flag. The test file originally comes from the related WPT test case: https://github.com/web-platform-tests/wpt/blob/master/png/support/cicp-display-p3.png Note that I reencoded the file to make it match libpng's default encoding parameters (it only modifies the IDAT chunk). This is a cherry-pick of commit 65925ad4b2cbed934d5d850fe764dc46c4becbcb from branch 'libpng18'. Reviewed-by: John Bowler <jbowler@acm.org> Reviewed-by: Chris Blume <ProgramMax@gmail.com> Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 6f786ff0 2025-01-02T11:08:58 Update the copyright year Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta c1cc0f3f 2024-10-18T16:16:16 [libpng16] build: Rename a private function to benefit C++Builder Embarcadero's compilers, old (Borland-based) and new (Clang-based), do have full support for Standard C. The Clang-based compiler is claiming, through the macro __STDC_VERSION__, to support C99 and C11, whereas the Borland-based compiler supports ANSI C, as it has for decades. However, their run-time library is exposing global functions beyond the scope of Standard C, for backwards compatibility with the older Borland products. One of these functions is `randomize`, which clashes with a function inside pngvalid.c that incidentally has the same name. Building libpng in "Strict ANSI C" mode, in which all Borland-specific globals are hidden (e.g. via `bcc32 -A`), would have been a workable solution for the Borland-based ANSI C compiler, but no such solution appears to exist for the Clang-based C90/C99/C11 compiler. Fortunately, renaming a private function inside a test program is a cost-free alternative fix. This is a cherry-pick of commit 6184164aa73ee764b1822f44d3db7619cf84f3fa from branch 'libpng18'.
Cosmin Truta d9d70e65 2024-10-17T12:09:53 [libpng16] refactor: Deduplicate the interlace arrays `png_pass_*` Move the definitions of interlace arrays to the top of their respective translation units, to reduce their repeated copying in various places of the codebase. TODO: As they still exist in three copies, in pngpread.c, in pngrutil.c, and in pngwutil.c, they should all be further moved to a common place. This is a cherry-pick of commit 620a2b73b22df66ed099e1faacac2d92f48252b7 from branch 'libpng18'.
John Bowler 76e5ec21 2024-10-14T12:26:22 [libpng16] test: Add a compile-time check in pngimage.c to avoid a failure Disable the check on `interlace_method` inside function `compare_read` in pngimage.c, if WRITE_INTERLACING is not supported. If interlaced encoding is disabled inside libpng, the encoded images are non-interlaced silently and unconditionally. This commit updates the image comparison to skip the interlace check in the resultant image; other behavior is still checked. This is a cherry-pick of commit d9f13d8d846e08b00f6530b7a5fe07039d48c78d from branch 'libpng18'. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
John Bowler 65470ac8 2024-10-12T14:55:03 fix: Avoid integer overflows in function `png_xy_from_XYZ` This is a cherry-picked of commit f45531cc141dc20dc7a4046bbe92270b1e799a5d from branch 'libpng18'. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>