3 Imager::Security - brief notes on security and image processing
7 # keep abreast of security updates
8 apt-get update && apt-get upgrade
10 pkgin update && pkgin upgrade
15 # only images that use up to 10MB
16 Imager->set_file_limits(bytes => 10_000_000);
20 There's two basic security considerations when dealing with images
21 from an unknown source:
27 keeping your libraries up to date
31 limiting the amount of memory used to store images
35 =head2 Keeping libraries up to date
37 Image file format libraries such as C<libpng> or C<libtiff> have
38 relatively frequent security updates, keeping your libraries up to
39 date is basic security.
41 If you're using user supplied fonts, you will need to keep your font
42 libraries up to date too.
44 =head2 Limiting memory used
46 With compression, and especially with pointer formats like TIFF, it's
47 possible to store very large images in a relatively small file.
49 If you're receiving image data from an untrusted source you should
50 limit the amount of memory that Imager can allocate for a read in
51 image file using the C<set_file_limits()> method.
53 Imager->set_file_limits(bytes => 10_000_000);
55 You may also want to limit the maximum width and height of images read
58 Imager->set_file_limits(width => 10_000, height => 10_000,
61 This has no effect on images created without a file:
64 my $image = Imager->new(xsize => 10_001, ysize => 10_001);
66 You can reset to the defaults with:
68 Imager->set_file_limits(reset => 1);
72 Tony Cook <tonyc@cpan.org>