From 1f4e054c12f9416fddb11e574335cb788e09671c Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 27 Aug 2011 23:09:40 +0000 Subject: 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 --- doc/HISTORY | 14 +++++++++----- lib/libpm.c | 4 ++++ 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 . - 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 . - 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 . + 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; -- cgit 1.4.1