summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-06 14:42:25 +0000
committerRobin Watts <robin.watts@artifex.com>2012-01-06 14:45:38 +0000
commit6dd9108c5865c1ea2ab0e834f4ae85aa279bcca9 (patch)
treefe3d0a01115cf56f5e9d74c1810094ee2bd8338c /pdf
parente504b09e060020c6e7d3478f617a24528de4116d (diff)
downloadmupdf-6dd9108c5865c1ea2ab0e834f4ae85aa279bcca9.tar.xz
Various fixes to avoid arithmetic problems.
Various fixes to avoid overflow problems, division by zeros, use of uninitialised variables etc. All from/suggested by Zenikos patch.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_annot.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c
index 228a214e..f7e7f081 100644
--- a/pdf/pdf_annot.c
+++ b/pdf/pdf_annot.c
@@ -328,8 +328,14 @@ pdf_transform_annot(pdf_annot *annot)
float w, h, x, y;
bbox = fz_transform_rect(matrix, bbox);
- w = (rect.x1 - rect.x0) / (bbox.x1 - bbox.x0);
- h = (rect.y1 - rect.y0) / (bbox.y1 - bbox.y0);
+ if (bbox.x1 == bbox.x0)
+ w = 0;
+ else
+ w = (rect.x1 - rect.x0) / (bbox.x1 - bbox.x0);
+ if (bbox.y1 == bbox.y0)
+ h = 0;
+ else
+ h = (rect.y1 - rect.y0) / (bbox.y1 - bbox.y0);
x = rect.x0 - bbox.x0;
y = rect.y0 - bbox.y0;