summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'base/gshtscr.c')
-rw-r--r--base/gshtscr.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/base/gshtscr.c b/base/gshtscr.c
index 29cd93e1..fe6a1c5a 100644
--- a/base/gshtscr.c
+++ b/base/gshtscr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -344,6 +344,15 @@ pick_cell_size(gs_screen_halftone * ph, const gs_matrix * pmat, ulong max_size,
if (u0 == 0 && v0 == 0)
return_error(gs_error_rangecheck);
+
+ /* We increment rt in a loop below until (u+v) * rt
+ * is at least 4. Make sure that rt has enough range
+ * to satisfy that calculation. If it doesn't then
+ * give up (silly values).
+ */
+ if ((fabs(u0) + fabs(v0)) < ((double)5.0 / max_int))
+ return_error(gs_error_rangecheck);
+
while ((fabs(u0) + fabs(v0)) * rt < 4)
++rt;
phcp->C = 0;