public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/perl-Imager] f44: Fix test failure
@ 2026-08-10  9:09 Jitka Plesnikova
  0 siblings, 0 replies; only message in thread
From: Jitka Plesnikova @ 2026-08-10  9:09 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/perl-Imager
Branch : f44
Commit : 65e30c4c752220f054ddbd2daef01f37c1b87f00
Author : Jitka Plesnikova <jplesnik@redhat.com>
Date   : 2026-08-10T11:09:35+02:00
Stats  : +100/-1 in 4 file(s)
URL    : https://src.fedoraproject.org/rpms/perl-Imager/c/65e30c4c752220f054ddbd2daef01f37c1b87f00?branch=f44

Log:
Fix test failure

---
diff --git a/.gitignore b/.gitignore
index 83d4551..2ee9c0c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,5 @@
 /Imager-1.032.tar.gz
 /Imager-1.033.tar.gz
 /Imager-1.034.tar.gz
+/exifbadifdstart2.bin
+/exifbadifdstart.bin

diff --git a/Imager-1.034-EXIF-add-missing-checks-for-the-start-of-an-ifd-entr.patch b/Imager-1.034-EXIF-add-missing-checks-for-the-start-of-an-ifd-entr.patch
new file mode 100644
index 0000000..b64e27e
--- /dev/null
+++ b/Imager-1.034-EXIF-add-missing-checks-for-the-start-of-an-ifd-entr.patch
@@ -0,0 +1,88 @@
+From 48ba8ac0749f89466b6e6681fb88cbdb51086ebd Mon Sep 17 00:00:00 2001
+From: Tony Cook <tony@develop-help.com>
+Date: Sat, 8 Aug 2026 16:02:49 +1000
+Subject: [PATCH] EXIF: add missing checks for the start of an ifd entry offset
+
+These was caught by a different check on 64-bit systems, but this
+wasn't caught on 32-bit systems.
+
+Fixes #568
+---
+ MANIFEST               | 2 ++
+ imexif.c               | 6 ++++--
+ t/450-api/100-inline.t | 9 ++++++++-
+ 3 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/MANIFEST b/MANIFEST
+index c060c156..d3c314bb 100644
+--- a/MANIFEST
++++ b/MANIFEST
+@@ -396,6 +396,8 @@ t/data/exifbadascoff.bin	EXIF block with bad ASCII field offset
+ t/data/exifbadderoff.bin	EXIF with (U32)-1 DE offset
+ t/data/exifbadifdoff1.bin	EXIF with (U32)-1 DE offset
+ t/data/exifbadifdoff2.bin	EXIF with (U32)-1 DE offset
++t/data/exifbadifdstart.bin
++t/data/exifbadifdstart2.bin
+ t/data/exifbadoff.bin		EXIF with bad directory entry offset
+ t/data/exifgood.bin		Good EXIF data block
+ t/GoodTestFont.pm		A dummy (hardly implemented) font driver.
+diff --git a/imexif.c b/imexif.c
+index 9ab8eb7c..62b9c061 100644
+--- a/imexif.c
++++ b/imexif.c
+@@ -936,7 +936,8 @@ tiff_load_ifd(imtiff *tiff, unsigned long offset) {
+   tiff_clear_ifd(tiff);
+ 
+   /* rough check count + 1 entry + next offset */
+-  if (offset + (2+12+4) > tiff->size) {
++  if (offset >= tiff->size
++      || offset + (2+12+4) > tiff->size) {
+     mm_log((2, "Exif: IFD start offset %lu beyond end of Exif block", offset));
+     return 0;
+   }
+@@ -972,7 +973,8 @@ tiff_load_ifd(imtiff *tiff, unsigned long offset) {
+       }
+       else {
+ 	entry->offset = tiff_get32(tiff, base+8);
+-	if (entry->offset + entry->size > tiff->size) {
++	if (entry->offset >= tiff->size
++            || entry->offset + entry->size > tiff->size) {
+ 	  mm_log((2, "Invalid data offset processing IFD\n"));
+ 	  myfree(entries);
+ 	  return 0;
+diff --git a/t/450-api/100-inline.t b/t/450-api/100-inline.t
+index fd99a46d..dc05da9e 100644
+--- a/t/450-api/100-inline.t
++++ b/t/450-api/100-inline.t
+@@ -779,6 +779,12 @@ ok(test_slots(), "call slot APIs");
+     ($im, $ok) = do_one_exif("t/data/exifbadifdoff1.bin");
+     ok(!$ok, "fail to load exif with bad exif ifd offset");
+ 
++    ($im, $ok) = do_one_exif("t/data/exifbadifdstart.bin");
++    ok(!$ok, "fail to load exif with bad exif ifd0 start offset");
++
++    ($im, $ok) = do_one_exif("t/data/exifbadifdstart2.bin");
++    ok(!$ok, "fail to load exif with bad exif exififd start offset");
++
+     ($im, $ok) = do_one_exif("t/data/exifbad0ascii.bin");
+     ok($ok, "load exif with zero length ascii")
+         or diag(Imager->_error_as_msg);
+@@ -798,13 +804,14 @@ ok(test_slots(), "call slot APIs");
+ 
+ sub do_one_exif {
+     my ($exif_name) = @_;
+-    
++
+     open my $exif_fh, "<", $exif_name
+         or die "Cannot open $exif_name: $!";
+     binmode $exif_fh;
+     my $exif_data = do { local $/; <$exif_fh> };
+     close $exif_fh;
+     $im = Imager->new(xsize => 1, ysize => 1);
++    Imager::i_log_entry("Testing $exif_name", 2);
+     my $ok = decode_exif($im, $exif_data);
+     
+     return ($im, $ok);
+-- 
+2.55.0
+

diff --git a/perl-Imager.spec b/perl-Imager.spec
index 6fa291b..7c113ee 100644
--- a/perl-Imager.spec
+++ b/perl-Imager.spec
@@ -5,6 +5,11 @@ Summary:        Perl extension for Generating 24 bit Images
 License:        GPL-1.0-or-later OR Artistic-1.0-Perl
 URL:            https://metacpan.org/release/Imager
 Source0:        https://cpan.metacpan.org/authors/id/T/TO/TONYC/Imager-%{version}.tar.gz
+# EXIF: add missing checks for the start of an ifd entry offset
+# https://github.com/tonycoz/imager/issues/568
+Source1:        exifbadifdstart.bin
+Source2:        exifbadifdstart2.bin
+Patch0:         Imager-1.034-EXIF-add-missing-checks-for-the-start-of-an-ifd-entr.patch
 BuildRequires:  freetype-devel
 BuildRequires:  giflib-devel
 BuildRequires:  libjpeg-devel
@@ -93,7 +98,9 @@ Summary: perl-Imager's Test module
 %{summary}.
 
 %prep
-%setup -q -n Imager-%{version}
+%autosetup -p1 -n Imager-%{version}
+cp %{SOURCE1} t/data/exifbadifdstart.bin
+cp %{SOURCE2} t/data/exifbadifdstart2.bin
 find -executable -type f -exec chmod -x {} \;
 perl -MConfig -pi -e 's|^#!perl|$Config{startperl}|' samples/*
 

diff --git a/sources b/sources
index 038143f..e5b9f3f 100644
--- a/sources
+++ b/sources
@@ -1 +1,3 @@
 SHA512 (Imager-1.034.tar.gz) = aad2065255724ed98db09cd23b0127d7346db835523d9804196bdfd8ef10ca5e21cda0a2e7d4d3ef32fdae86ead3f7be091aa9e332dbd0cdffb13f6a053ffac4
+SHA512 (exifbadifdstart2.bin) = 4ea2bf5ba4bc886ccd011f3b9c60412a2b88897607b99a04ed666fa2deb2b44ba6a9b929ac5143c99eff5e00930a7e74f2d8d188c99f6b794bc608d2f75adcdb
+SHA512 (exifbadifdstart.bin) = ff68c05713af63aca4dfb4768df70abee7395ffaa3ffae3b00bdc1d1dc2f710bc6c9a0b0c747a6a61c24c8a7016e988253885c5919a979a4abd069d5a964d443

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-10  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10  9:09 [rpms/perl-Imager] f44: Fix test failure Jitka Plesnikova

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox