summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-02-19 18:35:23 +0100
committerRobin Watts <robin.watts@artifex.com>2013-02-20 13:50:41 +0000
commit8bfa5489e1c4da07a2e8e480395052c0bc217ec9 (patch)
treedc91776c77cb800b067ee3db8552fb6b95f1d8d1 /fitz
parentb6519f17bf729617279e1feb78b08ce4fd56cd5b (diff)
downloadmupdf-8bfa5489e1c4da07a2e8e480395052c0bc217ec9.tar.xz
Bug 693639: fix overflow due to wrong type of intermediate variable.
Thanks to zeniko.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_geometry.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/fitz/base_geometry.c b/fitz/base_geometry.c
index d1d23eb8..378fd266 100644
--- a/fitz/base_geometry.c
+++ b/fitz/base_geometry.c
@@ -277,17 +277,10 @@ const fz_irect fz_unit_bbox = { 0, 0, 1, 1 };
fz_irect *
fz_irect_from_rect(fz_irect *restrict b, const fz_rect *restrict r)
{
- int i;
-
- i = floorf(r->x0);
- b->x0 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
- i = floorf(r->y0);
- b->y0 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
- i = ceilf(r->x1);
- b->x1 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
- i = ceilf(r->y1);
- b->y1 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
-
+ b->x0 = fz_clamp(floorf(r->x0), MIN_SAFE_INT, MAX_SAFE_INT);
+ b->y0 = fz_clamp(floorf(r->y0), MIN_SAFE_INT, MAX_SAFE_INT);
+ b->x1 = fz_clamp(ceilf(r->x1), MIN_SAFE_INT, MAX_SAFE_INT);
+ b->y1 = fz_clamp(ceilf(r->y1), MIN_SAFE_INT, MAX_SAFE_INT);
return b;
}