about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2014-02-09 18:05:14 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2014-02-09 18:05:14 +0000
commit986fb1796a2025591ef01778baccf45ae4341cd8 (patch)
tree69a8dc2712e9b679d9ffa4219e7197d024626682
parent6df52cf3846ae2afe8c3b633cd28126937311e90 (diff)
downloadnetpbm-mirror-986fb1796a2025591ef01778baccf45ae4341cd8.tar.gz
netpbm-mirror-986fb1796a2025591ef01778baccf45ae4341cd8.tar.xz
netpbm-mirror-986fb1796a2025591ef01778baccf45ae4341cd8.zip
Fix for -takeodd on image with no odd rows
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2122 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY15
-rw-r--r--editor/specialty/pamdeinterlace.c8
2 files changed, 16 insertions, 7 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 5a29fb26..39d33437 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,12 +6,6 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.66.00
 
-              ppmrelief: fix out-of-bound values in output.
-              Thanks Prophet of the Way <afu@wta.att.ne.jp>.
-
-              ppmrelief: fix crash when input image is too small.
-              Thanks Prophet of the Way <afu@wta.att.ne.jp>.
-
               pnmmargin: fix for size 0 and superfluous "unexpected operator" 
               message with size != 0.  Introduced in 10.42.
 
@@ -22,6 +16,15 @@ not yet  BJH  Release 10.66.00
               pstopnm: fix wrong orientation sometimes when you specify
               both -xsize and -ysize.  Introduced in 10.65.
 
+              ppmrelief: fix out-of-bound values in output.  Always broken.
+              Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
+              ppmrelief: fix crash when input image is too small.  Always
+              broken.  Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
+              pamdeinterlace: fix incorrect output with -takeodd and image has
+              only one row.  Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
               build/install: add tools for creating a Debian package.
 
               make package: Include template for pkgconfig file.
diff --git a/editor/specialty/pamdeinterlace.c b/editor/specialty/pamdeinterlace.c
index aa1f3ff7..d6f6aee1 100644
--- a/editor/specialty/pamdeinterlace.c
+++ b/editor/specialty/pamdeinterlace.c
@@ -32,7 +32,7 @@ parseCommandLine(int argc, char ** argv,
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
     optStruct3 opt;  /* set by OPTENT3 */
-    optEntry *option_def;
+    optEntry * option_def;
     unsigned int option_def_index;
 
     unsigned int takeeven, takeodd;
@@ -50,6 +50,8 @@ parseCommandLine(int argc, char ** argv,
     pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
+    free(option_def);
+
     if (takeeven && takeodd)
         pm_error("You cannot specify both -takeeven and -takeodd options.");
 
@@ -90,6 +92,10 @@ main(int argc, char *argv[]) {
     
     pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
 
+    if (inpam.height < 2 && cmdline.rowsToTake == ODD)
+        pm_error("You requested to take the odd rows, but there aren't "
+                 "any odd rows in the image - it has only one row - Row 0");
+
     tuplerow = pnm_allocpamrow(&inpam);
 
     outpam = inpam;    /* Initial value -- most fields should be same */