From 823416fb2e8de0a5c67947d3df5ae1f2f0a4c3f8 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 12 Aug 2022 02:44:14 +0000 Subject: Fix segfault from use before set git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4403 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- editor/pamcat.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'editor/pamcat.c') diff --git a/editor/pamcat.c b/editor/pamcat.c index adc88e29..d8f6613e 100644 --- a/editor/pamcat.c +++ b/editor/pamcat.c @@ -720,9 +720,11 @@ createLrImgCtlArray(const struct pam * const inpam, /* array */ thisEntryP->out = (i == 0 ? &newTuplerow[0] : imgCtl[i-1].out + inpam[i-1].width); - if (inpamP->height == outpamP->height) /* no vertical padding */ - thisEntryP->cachedRow = NULL; - else { + if (inpamP->height == outpamP->height) { /* no vertical padding */ + thisEntryP->cachedRow = NULL; + pnm_createBlackTuple(outpamP, &thisEntryP->background); + /* Meaningless because no padding */ + } else { /* Determine pad color */ switch (padColorMethod){ case PAD_AUTO: -- cgit 1.4.1