about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-02-27 04:44:35 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-02-27 04:44:35 +0000
commit9f95511f291ecc492e283932064857717678bb19 (patch)
tree7907eb2c3a54851b9f0635d061a16466636896bf
parent3f3a0bb41c579c667871ac322534c59323f1d801 (diff)
downloadnetpbm-mirror-9f95511f291ecc492e283932064857717678bb19.tar.gz
netpbm-mirror-9f95511f291ecc492e283932064857717678bb19.tar.xz
netpbm-mirror-9f95511f291ecc492e283932064857717678bb19.zip
Release 10.97.05
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4287 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY9
-rw-r--r--editor/pamsistoaglyph.c7
-rw-r--r--other/pambayer.c38
-rw-r--r--version.mk2
4 files changed, 53 insertions, 3 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 18ec8982..a3989fe8 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,15 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+22.02.27 BJH  Release 10.97.05
+
+              pamsistoaglyph: Fix invalid memory reference and incorrect
+              output on depth 1 input.  Always broken.  (pamsistoaglyph was
+              new in Netpbm 10.47 (June 2009).  Thanks Scott Pakin.
+
+              pambayer: Fix bogus colors at edges.  Always broken (pambayer
+              was new in Release 10.30 (October 2005)).
+
 22.02.13 BJH  Release 10.97.04
 
               libnetpbm, various programs: fix bug: bogus warning that a color
diff --git a/editor/pamsistoaglyph.c b/editor/pamsistoaglyph.c
index 6b093520..f9e25518 100644
--- a/editor/pamsistoaglyph.c
+++ b/editor/pamsistoaglyph.c
@@ -6,7 +6,7 @@
  *
  * ----------------------------------------------------------------------
  *
- * Copyright (C) 2009 Scott Pakin <scott+pbm@pakin.org>
+ * Copyright (C) 2009-2022 Scott Pakin <scott+pbm@pakin.org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -127,7 +127,10 @@ readAsGray( const char * const fileName,
         for (col = 0; col < pamP->width; ++col) {
             double YP, CbP, CrP;
 
-            pnm_YCbCrtuple( tuplerow[col], &YP, &CbP, &CrP );
+            if (pamP->depth >= 3)
+                pnm_YCbCrtuple(tuplerow[col], &YP, &CbP, &CrP);
+            else
+                YP = (double) tuplerow[col][0];
             grayArray[row][col] = (gray)
                 (YP * maxGrayVal / (double)pamP->maxval);
         }
diff --git a/other/pambayer.c b/other/pambayer.c
index 7fc1f809..9cffc8f0 100644
--- a/other/pambayer.c
+++ b/other/pambayer.c
@@ -78,6 +78,8 @@ parseCommandLine(int argc, const char ** argv,
     pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
+    free(option_def);
+
     if (argc-1 < 1)
         cmdlineP->inputFilespec = "-";
     else if (argc-1 > 1)
@@ -101,6 +103,41 @@ parseCommandLine(int argc, const char ** argv,
 
 
 static void
+clearTuples(const struct pam * const pamP,
+	    tuple **           const outtuples) {
+
+    unsigned int row;
+    unsigned int col;
+    unsigned int plane;
+
+    if(pamP->height <= 4 || pamP->width <= 4) {
+        for(row=0; row < pamP->height; ++row)
+          for(col=0; col < pamP->width; ++col)
+            for (plane=0; plane < pamP->depth; ++plane)
+              outtuples[row][col][plane] = 0;
+    }
+    else {
+        for(col = 0; col < pamP->width; ++col)
+            for (plane = 0; plane < pamP->depth; ++plane) {
+                outtuples[0][col][plane] = 0;
+                outtuples[1][col][plane] = 0;
+                outtuples[pamP->height-2][col][plane] = 0;
+                outtuples[pamP->height-1][col][plane] = 0;
+          }
+
+        for(row = 2; row < pamP->height - 2; ++row)
+            for (plane = 0; plane < pamP->depth; ++plane) {
+                outtuples[row][0][plane] = 0;
+                outtuples[row][1][plane] = 0;
+                outtuples[row][pamP->width-2][plane] = 0;
+                outtuples[row][pamP->width-1][plane] = 0;
+            }
+    }
+}
+
+
+
+static void
 calc_4(const struct pam * const pamP,
        tuple **           const intuples,
        tuple **           const outtuples,
@@ -319,6 +356,7 @@ main(int argc, const char **argv) {
     makeOutputPam(&inpam, &outpam);
 
     outtuples = pnm_allocpamarray(&outpam);
+    clearTuples(&outpam, outtuples);
 
     for (plane = 0; plane < 3; ++plane) {
         struct compAction const compAction = compActionTable[plane];
diff --git a/version.mk b/version.mk
index 0464d5a6..fef2c67f 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 97
-NETPBM_POINT_RELEASE = 4
+NETPBM_POINT_RELEASE = 5