diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-01-09 18:03:12 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-01-10 12:57:21 +0000 |
commit | 3c2b088942d733ae1f82bc7310db28bed332a9ba (patch) | |
tree | 8a573afa91acbb66a34ddf749a3870430bb4c9cf /source/fitz | |
parent | a83c2bc591d584b2b6a8f98d7032e3d53f09ed93 (diff) | |
download | mupdf-3c2b088942d733ae1f82bc7310db28bed332a9ba.tar.xz |
Bug 694879: Fix SEGV in draw-simple-scale.
Problems caused by the fact that -0x8000000 = 0x80000000.
Sidestep the problem for all coords where floats cannot accurately
represent them.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/draw-scale-simple.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/fitz/draw-scale-simple.c b/source/fitz/draw-scale-simple.c index 1ec6ffd8..939464a1 100644 --- a/source/fitz/draw-scale-simple.c +++ b/source/fitz/draw-scale-simple.c @@ -1233,6 +1233,8 @@ fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float /* Avoid extreme scales where overflows become problematic. */ if (w > (1<<24) || h > (1<<24) || w < -(1<<24) || h < -(1<<24)) return NULL; + if (x > (1<<24) || y > (1<<24) || x < -(1<<24) || y < -(1<<24)) + return NULL; /* Clamp small ranges of w and h */ if (w <= -1) @@ -1327,6 +1329,7 @@ fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float patch.y1 = dst_h_int; if (clip) { + DBUG(("Clip: (%d,%d) -> (%d,%d)\n", clip->x0, clip->y0, clip->x1, clip->y1)); if (flip_x) { if (dst_x_int + dst_w_int > clip->x1) @@ -1369,6 +1372,7 @@ fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float } } } + DBUG(("Patch: (%g,%g) -> (%g,%g)\n", patch.x0, patch.y0, patch.x1, patch.y1)); if (patch.x0 >= patch.x1 || patch.y0 >= patch.y1) return NULL; |