From 62ee2845e8eb1c42ba1935ecaeb015f14cd4700a Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 9 Mar 2024 21:05:32 +0000 Subject: Fix where extracted rectangle is entirely below the input image in PBM fast path git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4865 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- doc/HISTORY | 9 +++++++++ editor/pamcut.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/HISTORY b/doc/HISTORY index f0b813d4..e7525682 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -8,6 +8,15 @@ not yet BJH Release 11.06.00 pamcut: add -reportonly. + pamcut: fix incorrect output when rectangle to cut is entirely + above the input image. Invisible junk after image. Always + broken. (The ability to cut outside the input image was new in + pamcut's predecessor pnmcut in Netpbm 9.7 (August 2000). + + pamcut: fix incorrect output with PBM input when rectangle to + cut is entirely below the input image. Invisible junk after + image. Broken in Netpbm 10.44 (September 2008). + ppmtowinicon: fix array overrun with 4 and 8 bits per pixel. Broken in Netpbm 11.05 (December 2023). diff --git a/editor/pamcut.c b/editor/pamcut.c index c495c11b..31b44f81 100644 --- a/editor/pamcut.c +++ b/editor/pamcut.c @@ -784,7 +784,7 @@ extractRowsPbm(const struct pam * const inpamP, /* Write out bottom padding */ makeBlackPbmRow(bitrow, outpamP->width); - for (; row < bottomrow+1; ++row) + for (row = MAX(inpamP->height, toprow); row < bottomrow+1; ++row) pbm_writepbmrow_packed(outpamP->file, bitrow, outpamP->width, 0); pbm_freerow_packed(bitrow); -- cgit 1.4.1