[PATCH] pngcheck: check 4th byte of header

Lucy Phipps <[email protected]> Wed, 9 Dec 2020 07:04:12 +0000
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAGOd_F_o-oJPQuoxY4TKnryO38BwN2v6cuF0DJbZFiEn4uXT_Q@mail.gmail.com>
Turns out this doesn't report an error on PNGSuite xs4n0g01 (signature byte
4 lowercase), and I traced the problem to here a single comparison in
check_magic.
I originally submitted this to https://github.com/jbowler/pngcheck/pull/2
on the 30th of June 2019, and am finally submitting it upstream now, after
noticing the 2.4.0 release
---
 pngcheck.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pngcheck.c b/pngcheck.c
index 2574ffe..486bacf 100644
--- a/pngcheck.c
+++ b/pngcheck.c
@@ -4868,7 +4868,7 @@ int check_magic(uch *magic, char *fname, int which)
   const uch *good_magic = (which == 0)? good_PNG_magic :
                           ((which == 1)? good_MNG_magic : good_JNG_magic);

-  for (i = 1; i < 3; ++i)
+  for (i = 1; i <= 3; ++i)
   {
     if (magic[i] != good_magic[i]) {
       return 2;
-- 
2.29.2

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement