about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2014-09-26 14:17:56 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2014-09-26 14:17:56 +0000
commitd93a83fb600112a3411a5a4931a2c1cb914e6079 (patch)
treeb2430ebab9c558c4d56dd7e69728569d243c5166 /lib
parent77eb12eb2edf32eb91a1e7ff11422500cca6c8ef (diff)
downloadnetpbm-mirror-d93a83fb600112a3411a5a4931a2c1cb914e6079.tar.gz
netpbm-mirror-d93a83fb600112a3411a5a4931a2c1cb914e6079.tar.xz
netpbm-mirror-d93a83fb600112a3411a5a4931a2c1cb914e6079.zip
Release 10.35.94
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@2288 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/libpm.c16
-rw-r--r--lib/libsystem.c9
-rw-r--r--lib/ppm.h4
3 files changed, 14 insertions, 15 deletions
diff --git a/lib/libpm.c b/lib/libpm.c
index 2e563a09..f00f5d16 100644
--- a/lib/libpm.c
+++ b/lib/libpm.c
@@ -213,7 +213,13 @@ pm_allocarray(int const cols, int const rows, int const size )  {
     if (rowIndex == NULL)
         pm_error("out of memory allocating row index (%u rows) for an array",
                  rows);
-    rowheap = malloc(rows * cols * size);
+
+    if (cols != 0 && rows != 0 && UINT_MAX / cols / rows < size)
+        /* Too big even to request the memory ! */
+        rowheap = NULL;
+    else
+        rowheap = malloc((unsigned int)rows * cols * size);
+
     if (rowheap == NULL) {
         /* We couldn't get the whole heap in one block, so try fragmented
            format.
@@ -576,7 +582,7 @@ pm_proginit(int * const argcP, char * argv[]) {
     show_version = FALSE;
     show_help = FALSE;
     pm_plain_output = FALSE;
-    for (argn = 1; argn < *argcP; ++argn) {
+    for (argn = i = 1; argn < *argcP; ++argn) {
         if (pm_keymatch(argv[argn], "-quiet", 6) ||
             pm_keymatch(argv[argn], "--quiet", 7)) 
             showmessages = FALSE;
@@ -591,11 +597,9 @@ pm_proginit(int * const argcP, char * argv[]) {
                  pm_keymatch(argv[argn], "--plain", 7))
             pm_plain_output = TRUE;
         else
-            continue;
-        for (i = argn + 1; i <= *argcP; ++i)
-            argv[i - 1] = argv[i];
-        --(*argcP);
+            argv[i++] = argv[argn];
     }
+    *argcP=i;
 
     pm_setMessage((unsigned int) showmessages, NULL);
 
diff --git a/lib/libsystem.c b/lib/libsystem.c
index 082ffdc0..b2f78ed4 100644
--- a/lib/libsystem.c
+++ b/lib/libsystem.c
@@ -201,8 +201,6 @@ signalName(unsigned int const signalClass) {
         return "SIGTTIN";
     case SIGTTOU: /* POSIX.1 */
         return "SIGTTOU";
-    case SIGURG:
-        return "SIGURG";
     case SIGXCPU:
         return "SIGXCPU";
     case SIGXFSZ:
@@ -211,10 +209,6 @@ signalName(unsigned int const signalClass) {
         return "SIGVTALRM";
     case SIGPROF:
         return "SIGPROF";
-    case SIGWINCH:
-        return "SIGWINCH";
-    case SIGIO:
-        return "SIGIO";
     case SIGSYS:
         return "SIGSYS";
     default:
@@ -223,7 +217,8 @@ signalName(unsigned int const signalClass) {
         /* There are various other signal classes on some systems, but
            not defined by POSIX and not on at least one system we
            know of for which someone wanted to compile Netpbm.  The
-           list includes: SIGPWR, SIGLOST, SIGINFO, SIGRTxx.
+           list includes: SIGPWR, SIGLOST, SIGINFO, SIGRTxx,
+           SIGURG, SIGWINCH, SIGIO.
         */
     }
 }
diff --git a/lib/ppm.h b/lib/ppm.h
index 033330b9..8471e767 100644
--- a/lib/ppm.h
+++ b/lib/ppm.h
@@ -233,7 +233,7 @@ struct hsv
 ppm_hsv_from_color(pixel  const color,
                    pixval const maxval);
 
-static __inline pixval
+static __inline__ pixval
 ppm_colorvalue(pixel const p) {
 /*----------------------------------------------------------------------------
   The color value (V is HSV) as a pixval
@@ -241,7 +241,7 @@ ppm_colorvalue(pixel const p) {
     return PPM_MAX(PPM_GETR(p), PPM_MAX(PPM_GETG(p), PPM_GETB(p)));
 }
 
-static __inline pixval
+static __inline__ pixval
 ppm_saturation(pixel const p,
                pixval const maxval) {
 /*----------------------------------------------------------------------------