The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

limits.c - manages data/functions for limiting the sizes of images read from files.

SYNOPSIS

  // user code
  if (!i_set_image_file_limits(max_width, max_height, max_bytes)) {
    // error
  }
  i_get_image_file_limits(&max_width, &max_height, &max_bytes);

  // file reader implementations
  if (!i_int_check_image_file_limits(width, height, channels, sizeof(i_sample_t))) {
    // error handling
  }

DESCRIPTION

Manage limits for image files read by Imager.

Setting a value of zero means that limit will be ignored.

im_set_image_file_limits(ctx, width, height, bytes) =category Files =synopsis im_set_image_file_limits(aIMCTX, 500, 500, 1000000); =synopsis i_set_image_file_limits(500, 500, 1000000);

Set limits on the sizes of images read by Imager.

Setting a limit to 0 means that limit is ignored.

Negative limits result in failure.

Parameters:

  • i_img_dim width, height - maximum width and height.

  • size_t bytes - maximum size in memory in bytes. A value of zero sets this limit to one gigabyte.

Returns non-zero on success.

Also callable as i_set_image_file_limits(width, height, bytes).

im_get_image_file_limits(ctx, &width, &height, &bytes) =category Files =synopsis im_get_image_file_limits(aIMCTX, &width, &height, &bytes) =synopsis i_get_image_file_limits(&width, &height, &bytes)

Retrieves the file limits set by i_set_image_file_limits().

  • i_img_dim *width, *height - the maximum width and height of the image.

  • size_t *bytes - size in memory of the image in bytes.

Also callable as i_get_image_file_limits(&width, &height, &bytes).

im_int_check_image_file_limits(width, height, channels, sample_size) =category Files =synopsis im_int_check_image_file_limits(aIMCTX, width, height, channels, sizeof(i_sample_t)) =synopsis i_int_check_image_file_limits(width, height, channels, sizeof(i_sample_t))

Checks the size of a file in memory against the configured image file limits.

This also range checks the values to those permitted by Imager and checks for overflows in calculating the size.

Returns non-zero if the file is within limits.

This function is intended to be called by image file read functions.

Also callable as i_int_check_image_file_limits(width, height, channels, sizeof(i_sample_t).

1 POD Error

The following errors were encountered while parsing the POD:

Around line 25:

=over without closing =back