about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY3
-rw-r--r--generator/ppmforge.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 6a7eb422..7cf589be 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -19,6 +19,9 @@ not yet  BJH  Release 10.94.00
               pamexec: Issue message instead of being killed by a signal when
               the exec'ed program does not read the whole image"
 
+              ppmforge: Fail if -dimension is greater than 5, which is
+              useless.
+
               pamscale: Fix bogus "bad magic number" or similar failure most
               of the time with -nomix.  Broken since Netpbm 10.49 (December
               2009).
diff --git a/generator/ppmforge.c b/generator/ppmforge.c
index c7cfdb84..7cef571f 100644
--- a/generator/ppmforge.c
+++ b/generator/ppmforge.c
@@ -34,6 +34,7 @@
 #define _XOPEN_SOURCE 500  /* get M_PI in math.h */
 
 #include <math.h>
+#include <float.h>
 #include <assert.h>
 
 #include "pm_c_util.h"
@@ -169,6 +170,11 @@ parseCommandLine(int argc, const char **argv,
         if (cmdlineP->dimension <= 0.0)
             pm_error("-dimension must be greater than zero.  "
                      "You specified %f", cmdlineP->dimension);
+        else if (cmdlineP->dimension > 5.0 + FLT_EPSILON)
+            pm_error("-dimension must not be greater than 5.  "
+                     "Results are not interesting with higher numbers, so "
+                     "we assume it is a mistake.  "
+                     "You specified %f", cmdlineP->dimension);
     } else
         cmdlineP->dimension = cmdlineP->clouds ? 2.15 : 2.4;