about summary refs log tree commit diff
path: root/urt/rle_getrow.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-08-09 03:06:48 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-08-09 03:06:48 +0000
commite6e30e94b1da12d0a3247db3b25311bafb8230e6 (patch)
tree546d163508fa3e3b4fa577e85c424357c2027c42 /urt/rle_getrow.c
parente281482f7522e2ccf8f4fad6f194f7ef7d77ef10 (diff)
downloadnetpbm-mirror-e6e30e94b1da12d0a3247db3b25311bafb8230e6.tar.gz
netpbm-mirror-e6e30e94b1da12d0a3247db3b25311bafb8230e6.tar.xz
netpbm-mirror-e6e30e94b1da12d0a3247db3b25311bafb8230e6.zip
Remove RLE_CHECK_ALLOC and rle_alloc_error from URT library. This fixes a wild pointer dereference as well as cleans up code
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3656 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'urt/rle_getrow.c')
-rw-r--r--urt/rle_getrow.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/urt/rle_getrow.c b/urt/rle_getrow.c
index 679811cc..ae220f5b 100644
--- a/urt/rle_getrow.c
+++ b/urt/rle_getrow.c
@@ -102,9 +102,13 @@ rle_get_setup(rle_hdr * const the_hdr) {
         rle_pixel * bg_color;
 
         MALLOCARRAY(the_hdr->bg_color, setup.h_ncolors);
+        if (!the_hdr->bg_color)
+            pm_error("Failed to allocation array for %u background colors",
+                     setup.h_ncolors);
         MALLOCARRAY(bg_color, 1 + (setup.h_ncolors / 2) * 2);
-        RLE_CHECK_ALLOC(the_hdr->cmd, the_hdr->bg_color && bg_color,
-                        "background color" );
+        if (!bg_color)
+            pm_error("Failed to allocation array for %u background colors",
+                     1+(setup.h_ncolors / 2) * 2);
         fread((char *)bg_color, 1, 1 + (setup.h_ncolors / 2) * 2, infile);
         for (i = 0; i < setup.h_ncolors; ++i)
             the_hdr->bg_color[i] = bg_color[i];