about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY4
-rw-r--r--editor/pamcut.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index b16d131c..ade42e40 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,10 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+not yet  BJH  Release 10.46.00
+
+              pamcut: fix bug with PBM and -pad.
+
 08.12.28 BJH  Release 10.45.00
 
               pgmnoise: Add -randomseed.
diff --git a/editor/pamcut.c b/editor/pamcut.c
index 76a57f8e..ce63da7b 100644
--- a/editor/pamcut.c
+++ b/editor/pamcut.c
@@ -658,7 +658,8 @@ cutOneImage(FILE *             const ifP,
 
     pnm_writepaminit(&outpam);
 
-    if (PNM_FORMAT_TYPE(outpam.format) == PBM_TYPE)
+    if (PNM_FORMAT_TYPE(outpam.format) == PBM_TYPE &&
+        leftcol >= 0 && rightcol < inpam.width)
         extractRowsPBM(&inpam, &outpam, leftcol, rightcol, toprow, bottomrow);
     else
         extractRowsGen(&inpam, &outpam, leftcol, rightcol, toprow, bottomrow);