Security Advisories (3)
CVE-2016-1238 (2016-08-02)

Imager would search the default current directory entry in @INC when searching for file format support modules.

CPANSA-Imager-2014-01 (2014-01-03)

When drawing on an image with an alpha channel where the source minimum is greater than zero, Imager would read from beyond the end of a malloc() allocated buffer. In rare circumstances this could lead to some of the source image not being written to the target image, or possibly to a segmentation fault.

CVE-2024-53901 (2024-11-17)

"invalid next size" backtrace on use of trim on certain images

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.

  • 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 -l<libbase>.

  • 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.