checkImageSize checks the image dimensions and number of frames against security options. It returns the image width, height and a security check error, if any.
( img *vips.Image, imgtype imagetype.Type, po ProcessingOptions, )
| 183 | // checkImageSize checks the image dimensions and number of frames against security options. |
| 184 | // It returns the image width, height and a security check error, if any. |
| 185 | func (p *Processor) checkImageSize( |
| 186 | img *vips.Image, |
| 187 | imgtype imagetype.Type, |
| 188 | po ProcessingOptions, |
| 189 | ) (int, int, error) { |
| 190 | width, height, frames := p.getImageSize(img) |
| 191 | |
| 192 | if imgtype.IsVector() { |
| 193 | // We don't check vector image dimensions as we can render it in any size |
| 194 | return width, height, nil |
| 195 | } |
| 196 | |
| 197 | err := p.securityChecker.CheckDimensions(po.Options, width, height, frames) |
| 198 | |
| 199 | return width, height, err |
| 200 | } |
| 201 | |
| 202 | // getImageSize returns the width and height of the image, taking into account |
| 203 | // orientation and animation. |
no test coverage detected