about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY3
-rw-r--r--editor/pnmscalefixed.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 4b9ce1a3..6813d6ab 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -17,6 +17,9 @@ not yet  BJH  Release 11.05.00
               ppmtoxpm: fix incorrect output with insanely large number of
               colors.
 
+              pnmscalefixed: fix incorrect output with really big image and
+              -pixels option.
+
               Build: Fix compile error on systems without 'asprintf'.
               Introduced in Netpbm 11.04 (September 2023).
 
diff --git a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c
index 7d33a9c2..05d56578 100644
--- a/editor/pnmscalefixed.c
+++ b/editor/pnmscalefixed.c
@@ -215,7 +215,7 @@ compute_output_dimensions(const struct cmdline_info cmdline,
                           int * newrowsP, int * newcolsP) {
 
     if (cmdline.pixels) {
-        if (rows * cols <= cmdline.pixels) {
+        if (rows <= cmdline.pixels / cols) {
             *newrowsP = rows;
             *newcolsP = cols;
         } else {