Skip to content

Commit

Permalink
Fixed libpng warning when loading interlaced images
Browse files Browse the repository at this point in the history
We enable interlace transform when reading png.

Closes GH-8002.
  • Loading branch information
brettwhiteman authored and cmb69 committed Feb 8, 2022
1 parent 86c196b commit 1d48da6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PHP NEWS
- Core:
. Fixed Haiku ZTS build. (David Carlier)

- GD:
. Fixed libpng warning when loading interlaced images. (Brett)

- Iconv:
. Fixed bug GH-7953 (ob_clean() only does not set Content-Encoding). (cmb)
. Fixed bug GH-7980 (Unexpected result for iconv_mime_decode). (cmb)
Expand Down
5 changes: 5 additions & 0 deletions ext/gd/libgd/gd_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
break;
}

/* enable the interlace transform if supported */
#ifdef PNG_READ_INTERLACING_SUPPORTED
(void)png_set_interlace_handling(png_ptr);
#endif

png_read_update_info(png_ptr, info_ptr);

/* allocate space for the PNG image data */
Expand Down

0 comments on commit 1d48da6

Please sign in to comment.