MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / CheckDimensions

Method CheckDimensions

security/checker.go:53–70  ·  view source on GitHub ↗

CheckDimensions checks if the given dimensions are within the allowed limits

(o *options.Options, width, height, frames int)

Source from the content-addressed store, hash-verified

51
52// CheckDimensions checks if the given dimensions are within the allowed limits
53func (s *Checker) CheckDimensions(o *options.Options, width, height, frames int) error {
54 frames = max(frames, 1)
55
56 maxFrameRes := s.MaxAnimationFrameResolution(o)
57
58 if frames > 1 && maxFrameRes > 0 {
59 if width*height > maxFrameRes {
60 return newImageResolutionError("Source image frame resolution is too big")
61 }
62 return nil
63 }
64
65 if width*height*frames > s.MaxSrcResolution(o) {
66 return newImageResolutionError("Source image resolution is too big")
67 }
68
69 return nil
70}

Callers 1

checkImageSizeMethod · 0.80

Calls 3

MaxSrcResolutionMethod · 0.95
newImageResolutionErrorFunction · 0.85

Tested by

no test coverage detected