diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-01-06 14:42:25 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-01-06 14:45:38 +0000 |
commit | 6dd9108c5865c1ea2ab0e834f4ae85aa279bcca9 (patch) | |
tree | fe3d0a01115cf56f5e9d74c1810094ee2bd8338c /pdf | |
parent | e504b09e060020c6e7d3478f617a24528de4116d (diff) | |
download | mupdf-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.c | 10 |
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; |