shithub: jbig2

Download patch

ref: c5d61c78c0de785b74b86d4e5298e3cc7b9e2b68
parent: e12fa07da845515911db8be2f7cfa8ef551061ba
author: Masaki Ushizaka <masaki@ghostscript.com>
date: Fri Jul 16 05:13:41 EDT 2010

A little fix to allocating memory size

--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -324,7 +324,7 @@
 {
   int *LENCOUNT;
   int LENMAX = -1;
-  const int lencountsize = 256 * sizeof(*LENCOUNT);
+  const int lencountcount = 256;
   const Jbig2HuffmanLine *lines = params->lines;
   int n_lines = params->n_lines;
   int i, j;
@@ -337,13 +337,13 @@
   int CURCODE;
   int CURTEMP;
 
-  LENCOUNT = jbig2_new(ctx, int, lencountsize);
+  LENCOUNT = jbig2_new(ctx, int, lencountcount);
   if (LENCOUNT == NULL) {
     jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1,
       "couldn't allocate storage for huffman histogram");
     return NULL;
   }
-  memset(LENCOUNT, 0, lencountsize);
+  memset(LENCOUNT, 0, sizeof(int) * lencountcount);
 
   /* B.3, 1. */
   for (i = 0; i < params->n_lines; i++)