Skip to content
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

bug: pngimage.c: Disable the check on interlace_method if WRITE_INTERLACE is not supported. #623

Closed
wants to merge 1 commit into from

Conversation

jbowler
Copy link
Contributor

@jbowler jbowler commented Oct 14, 2024

Inside libpng if interlacing a PNG is disabled libpng silently removes
it. This updates pngimage.c to not check the interlace in the resultant
image, other behavior is still checked.

Signed-off-by: John Bowler jbowler@acm.org

…LACE is not supported.

Inside libpng if interlacing a PNG is disabled libpng silently removes
it.  This updates pngimage.c to not check the interlace in the resultant
image, other behavior is still checked.

Signed-off-by: John Bowler <jbowler@acm.org>
@jbowler
Copy link
Contributor Author

jbowler commented Oct 14, 2024

This is behaviour that dates back to the dawn of libpng. It's happening in pngwutil.c in the function png_write_IHDR. The line in question along with the PNG_WRITE_INTERLACING_SUPPORTED check seems to have been added by @glennrp on Jan 30, 1998, "Imported from libpng-0.99.tar".

Nevertheless that seems to have been a bug-fix; WRITE_INTERLACING was present in earlier versions, just buggy. It is first present in libpng-0.81 but is absent in libpng-0.71 It seems to have been added by Guy.

The danger of removing it now is that it is entirely possible quite a lot of code depends on it; pngimage uses pretty much the original design for png_info handling.

Copy link
Member

@ctruta ctruta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, typos notwithstanding. (But I got them.)

Just so you know, I'd like to avoid using the label "bug" for something that isn't core libpng. This is a conditional compilation issue in a contributed test program, so I'll label it as test. For somebody who has a cursory look in the git history (e.g. "with git log --oneline), mentioning a bug fix in a test program (not in the core libpng) looks unnecessarily scary. And the name pngimage.c doesn't help alleviating such a concern, either.

@ctruta
Copy link
Member

ctruta commented Oct 15, 2024

Integrated both in libpng16 and libpng18.

@ctruta ctruta closed this Oct 15, 2024
@jbowler
Copy link
Contributor Author

jbowler commented Oct 15, 2024

Technically it is a "PNG stream", not a "PNG file" because a file is always a stream (in ISO-C) but the inverse does not apply. Hum, in fact in the NT file system, Reiser4 and, arguably, traditional MACOS a "file" is a structured object however libpng can only write a PNG as a stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants