Security Advisories (3)
CVE-2026-102504 (2026-10-01)

Imager versions before 1.037 for Perl exit the process reading a raw image with an out-of-range raw_datachannels value in i_readraw_wiol. Nothing range-checks raw_datachannels. The line buffer is sized as the image width times the channel count with no overflow check, so a negative or very large count requests an excessive allocation. When it fails, Imager's allocator calls exit(3). Passing an untrusted raw_datachannels value to Imager->read() triggers an uncatchable exit.

CVE-2026-102505 (2026-10-01)

Imager versions before 1.037 for Perl overflow a heap buffer fetching float samples from a paletted image in i_gsampf_fp. For a paletted image, getsamples() with type "float" allocates a buffer of one sample per pixel and fetches every requested channel of each pixel into it. Requesting more than one channel writes past its end. An attacker-supplied image controls the overflowing bytes through its palette.

CVE-2026-112202 (2026-10-20)

Imager::File::GIF versions before 1.006 for Perl allow out-of-bounds reads when consolidating GIF images. With `gif_consolidate => 1`, palette indices from the image are used without checking the colour table's bounds. The i_readgif_low routine reads beyond the heap allocation and copies the bytes into output pixels. The default GIF reader is not affected. The same code ships bundled in the Imager distribution. An attacker supplying a crafted GIF can disclose adjacent heap memory through the decoded output and may crash the process.

NAME

Imager::Probe - hot needle of inquiry for libraries

SYNOPSIS

require Imager::Probe;

my %probe = 
  (
   # short name of what we're looking for (displayed to user)
   name => "FOO",
   # pkg-config lookup
   pkg => [ qw/name1 name2 name3/ ],
   # perl subs that probe for the library
   code => [ \&foo_probe1, \&foo_probe2 ],
   # or just: code => \&foo_probe,
   inccheck => sub { ... },
   libcheck => sub { ... },
   # search for this library if libcheck not supplied
   libbase => "foo",
   # library link time options, uses libbase to build options otherwise
   libopts => "-lfoo",
   # C code to check the library is sane
   testcode => "...",
   # header files needed
   testcodeheaders => [ "stdio.h", "foo.h" ],
  );
my $result = Imager::Probe->probe(\%probe)
  or print "Foo library not found: ",Imager::Probe->error;

DESCRIPTION

Does the probes that were hidden in Imager's Makefile.PL, pulled out so the file format libraries can be externalized.

The return value is either nothing if the probe fails, or a hash containing:

  • INC - -I and other C options

  • LIBS - -L, -l and other link-time options

  • DEFINE - -D options, if any.

The possible values for the hash supplied to the probe() method are:

  • pkg - an array of pkg-config names to probe for. If the pkg-config checks pass, inccheck and libcheck aren't used.

  • inccheck - a code reference that checks if the supplied include directory contains the required header files.

  • libcheck - a code reference that checks if the supplied library directory contains the required library files. Note: the Makefile.PL version of this was supplied all of the library file names instead. libcheck can also be an arrayref of library check code references, all of which must find a match for the library to be considered "found".

  • libbase - if inccheck is supplied, but libcheck isn't, then a libcheck that checks for liblibbase$Config{_a} and liblibbase.$Config{so} is created. If libopts isn't supplied then that can be synthesized as -llibbase. libbase can also be an arrayref of library base names to search for, in which case all of the libraries mentioned must be found for the probe to succeed.

  • libopts - if the libraries are found via inccheck/libcheck, these are the -l options to supply during the link phase.

  • code - a code reference to perform custom checks. Returns the probe result directly. Can also be an array ref of functions to call.

  • testcode - test C code that is run with Devel::CheckLib. You also need to set testcodeheaders.

  • testcodeprologue - C code to insert between the headers and the main function.

  • incpath - $Config{path_sep} separated list of header file directories to check, or a reference to an array of such.

  • libpath - $Config{path_sep} separated list of library file directories to check, or a reference to an array of such.

  • alternatives - an optional array reference of alternate configurations (as hash references) to test if the primary configuration isn't successful. Each alternative should include an altname key describing the alternative. Any key not mentioned in an alternative defaults to the value from the main configuration.

AUTHOR

Tony Cook <tonyc@cpan.org>, Arnar M. Hrafnkelsson