bookingcom / carbonapi

High-performance Graphite frontend in Go
Other
81 stars 23 forks source link

Added check for the image size before calling cairo. #483

Closed grzkv closed 1 year ago

grzkv commented 1 year ago

What issue is this change attempting to solve?

Looks like cairo.ImageSurfaceCreate can be called with the image size larger than the one allowed. The maximum can be looked up e.g. here https://github.com/ImageMagick/cairo/blob/main/src/cairo-image-surface.c#L62 It's also mentioned in the mailing lists https://cairo.cairographics.narkive.com/Mkjwvkep/32k-limit-with-image-surface The lists are old, but seems like the limitation is still in place.

How does this change solve the problem? Why is this the best approach?

Added a check.