]> git.eshelyaron.com Git - emacs.git/commit
Improve overflow checking in svg_load_image
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 3 Dec 2021 17:47:22 +0000 (09:47 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 3 Dec 2021 18:25:09 +0000 (10:25 -0800)
commitbcb4651c412dc8b37f1e9978681a958b7e919277
tree535351f28517991db5198f72d7408f083f7067d7
parent02386da9389104ca4d4dde875a3fdac36eb10555
Improve overflow checking in svg_load_image

* src/image.c: Include math.h, for lrint.
(scale_image_size, compute_image_size): Use ‘double’, not ‘int’
for image size args, since librsvg uses ‘double’ for pixel counts.
(scale_image_size): Use ceil instead of rounding, to avoid
discarding fractional SVG pixels.  Divisor and multiplier are now
double instead of int, for better portability to librsvg
functions with fractional pixel sizes.
(image_get_dimension, compute_image_size, svg_load_image):
Be more careful about ignoring, rejecting or clipping scale
factors or sizes that are out of integer range.
(compute_image_size): Don’t bother to calculate :max-width if
:width is specified, and likewise for :max-height and :height.
src/image.c