all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Taegil Bae <esrevinu@gmail.com>
Cc: 35843-done@debbugs.gnu.org
Subject: bug#35843: PNG warning: Interlace handling should be turned on when using, png_read_image
Date: Tue, 21 May 2019 08:56:05 -0700	[thread overview]
Message-ID: <a7aeccb5-a79e-16d3-33fa-66aa2df263b3@cs.ucla.edu> (raw)
In-Reply-To: <CA+k_chLC02nzhYb2qoy+yUADqg2bdZNjGfRdBRzHHuBjyOhLSA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

Thanks for reporting the problem. It's not clear why interlace handling 
needs to be enabled manually when GNU Emacs will merely read the whole 
image (isn't libpng smart enough to do that on its own?) but I guess 
it's better to pacify libpng, if only to prevent users from worrying. I 
installed the attached patch.


[-- Attachment #2: 0001-Pacify-libpng-on-interlaced-images-Bug-35843.patch --]
[-- Type: text/x-patch, Size: 2391 bytes --]

From eeebdc49c0e113f1dd31b11c6addbc7082a406d6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
Date: Tue, 21 May 2019 08:51:48 -0700
Subject: [PATCH] Pacify libpng on interlaced images (Bug#35843)

* src/image.c (png_set_interlace_handling) [WINDOWSNT]:
New function to link.
(init_png_functions): Link it.
(png_load_body): Call it before calling png_read_update_info.
---
 src/image.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/image.c b/src/image.c
index 35ca3e2d66..57b405f6db 100644
--- a/src/image.c
+++ b/src/image.c
@@ -5802,6 +5802,7 @@ DEF_DLL_FN (png_uint_32, png_get_valid, (png_structp, png_infop, png_uint_32));
 DEF_DLL_FN (void, png_set_strip_16, (png_structp));
 DEF_DLL_FN (void, png_set_expand, (png_structp));
 DEF_DLL_FN (void, png_set_gray_to_rgb, (png_structp));
+DEF_DLL_FN (int, png_set_interlace_handling, (png_structp));
 DEF_DLL_FN (void, png_set_background,
 	    (png_structp, png_color_16p, int, int, double));
 DEF_DLL_FN (png_uint_32, png_get_bKGD,
@@ -5840,6 +5841,7 @@ init_png_functions (void)
   LOAD_DLL_FN (library, png_set_strip_16);
   LOAD_DLL_FN (library, png_set_expand);
   LOAD_DLL_FN (library, png_set_gray_to_rgb);
+  LOAD_DLL_FN (library, png_set_interlace_handling);
   LOAD_DLL_FN (library, png_set_background);
   LOAD_DLL_FN (library, png_get_bKGD);
   LOAD_DLL_FN (library, png_read_update_info);
@@ -5875,6 +5877,7 @@ init_png_functions (void)
 #  undef png_set_background
 #  undef png_set_expand
 #  undef png_set_gray_to_rgb
+#  undef png_set_interlace_handling
 #  undef png_set_longjmp_fn
 #  undef png_set_read_fn
 #  undef png_set_sig_bytes
@@ -5899,6 +5902,7 @@ init_png_functions (void)
 #  define png_set_background fn_png_set_background
 #  define png_set_expand fn_png_set_expand
 #  define png_set_gray_to_rgb fn_png_set_gray_to_rgb
+#  define png_set_interlace_handling fn_png_set_interlace_handling
 #  define png_set_longjmp_fn fn_png_set_longjmp_fn
 #  define png_set_read_fn fn_png_set_read_fn
 #  define png_set_sig_bytes fn_png_set_sig_bytes
@@ -6213,7 +6217,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
 	}
     }
 
-  /* Update info structure.  */
+  png_set_interlace_handling (png_ptr);
   png_read_update_info (png_ptr, info_ptr);
 
   /* Get number of channels.  Valid values are 1 for grayscale images
-- 
2.21.0


      reply	other threads:[~2019-05-21 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 13:01 bug#35843: PNG warning: Interlace handling should be turned on when using png_read_image Taegil Bae
2019-05-21 15:56 ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a7aeccb5-a79e-16d3-33fa-66aa2df263b3@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=35843-done@debbugs.gnu.org \
    --cc=esrevinu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.