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

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

CVE-2008-1928 (2008-04-24)

Buffer overflow in Imager 0.42 through 0.63 allows attackers to cause a denial of service (crash) via an image based fill in which the number of input channels is different from the number of output channels.

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-2007-2459 (2007-05-02)

Heap-based buffer overflow in the BMP reader (bmp.c) in Imager perl module (libimager-perl) 0.45 through 0.56 allows remote attackers to cause a denial of service (application crash) and possibly execute arbitrary code via crafted 8-bit/pixel compressed BMP files.

CVE-2006-0053 (2006-04-10)

Imager (libimager-perl) before 0.50 allows user-assisted attackers to cause a denial of service (segmentation fault) by writing a 2- or 4-channel JPEG image (or a 2-channel TGA image) to a scalar, which triggers a NULL pointer dereference.

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

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

NAME

Imager::Font::BBox - objects representing the bounding box of a string.

SYNOPSIS

use Imager::Font;

# get the object
my $font = Imager::Font->new(...);
my $bbox = $font->bounding_box(string=>$text, size=>$size);

# methods
my $start = $bbox->start_offset;
my $end = $bbox->end_offset;
my $gdescent = $box->global_descent;
my $gascent = $bbox->global_ascent;
my $ascent = $bbox->ascent;
my $decent = $bbox->descent;
my $total_width = $bbox->total_width;
my $fheight = $bbox->font_height;
my $theight = $bbox->text_height;

DESCRIPTION

Objects of this class are returned by the Imager::Font bounding_box() method when it is called in scalar context.

This will hopefully make the information from this method more accessible.

METHODS

start_offset()

Returns the horizonatal offset from the selected drawing location to the left edge of the first character drawn. If this is positive, the first glyph is to the right of the drawing location.

The alias neg_width() is present to match the bounding_box() documentation for list context.

end_offset()

The offset from the selected drawing location to the right edge of the last character drawn. Should always be positive.

You can use the alias pos_width() if you are used to the bounding_box() documentation for list context.

global_descent()

The lowest position relative to the font baseline that any character in the font reaches in the character cell. Normally negative.

At least one font we've seen has reported a positive number for this.

global_ascent()

The highest position relative to the font baseline that any character in the font reaches in the character cell. Normally positive.

descent()

The lowest position relative to the font baseline that any character in the supplied string reaches. Negative when any character's glyph reaches below the baseline.

ascent()

The highest position relative to the font baseline that any character in the supplied string reaches. Positive if any character's glyph reaches above the baseline.

advance_width()
total_width()

The total displayed width of the string.

font_height()

The maximum displayed height of any string using this font.

text_height()

The displayed height of the supplied string.

INTERNAL FUNCTIONS

new(...)

Called by Imager::Font->bounding_box() to create the object.

BUGS

Doesn't reproduce the functionality that you get using the x and y parameters to Imager::Font->bounding_box(). I considered:

my ($left, $top, $right, $bottom) = $box->offset(x=>$x, y=>$y)

but this is about as clumsy as the original.

AUTHOR

Tony Cook <tony@develop-help.com>

SEE ALSO

Imager(3), Imager::Font(3)