about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-27 23:09:40 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-27 23:09:40 +0000
commit1f4e054c12f9416fddb11e574335cb788e09671c (patch)
treead80b906a1744e44b904293fb056e1d1853e0228
parenta2e469051d6ba69f500c33aa92bfb71a59f7c784 (diff)
downloadnetpbm-mirror-1f4e054c12f9416fddb11e574335cb788e09671c.tar.gz
netpbm-mirror-1f4e054c12f9416fddb11e574335cb788e09671c.tar.xz
netpbm-mirror-1f4e054c12f9416fddb11e574335cb788e09671c.zip
Fix failure to check for failed memory allocation
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY14
-rw-r--r--lib/libpm.c4
2 files changed, 13 insertions, 5 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 8628a508..c9bd8c74 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -15,20 +15,24 @@ not yet  BJH  Release 10.56.00
               pnmtops: Add PBM fast path.  Thanks Prophet of the Way
               <afu@wta.att.ne.jp>.
 
-              libppmcmap and most programs that use color maps: speedup with
+              libnetpbm and most programs that use color maps: speedup with
               new color hash function.  Thanks Prophet of the Way
               <afu@wta.att.ne.jp>.
 
-              pnmtopng: fix bug: with -alpha specifying a mask which contains
-              no fully transparent area, output PNG is fully opaque.
-              Introduced in 10.29.
-
               pnmquant: use File::Temp::tempfile() instead of local
               approximation if it is available.
 
               pnmquant: work with older Perl that doesn't have 3-argument open.
               Thanks Slaven Rezic <srezic@iconmobile.com>.
 
+              libnetpbm, many programs: fix bug in pm_allocarray(): returns
+              NULL when can't get memory.  Calling programs thus crash on
+              very large images.  Introduced in 10.51.
+              
+              pnmtopng: fix bug: with -alpha specifying a mask which contains
+              no fully transparent area, output PNG is fully opaque.
+              Introduced in 10.29.
+
               ppmcie: fix bug: fails with "X coordinate out of range" error.
               Introduced in 10.51.
 
diff --git a/lib/libpm.c b/lib/libpm.c
index 62ba0180..69085099 100644
--- a/lib/libpm.c
+++ b/lib/libpm.c
@@ -328,6 +328,10 @@ pm_allocarray(int const cols,
 
     pm_mallocarray2(&result, rows, cols, elementSize);
 
+    if (result == NULL)
+        pm_error("Failed to allocate a raster array of %u columns x %u rows",
+                 cols, rows);
+
     retval = result;
 
     return retval;