diff -up xpdf-4.00/goo/gmem.cc.alloc xpdf-4.00/goo/gmem.cc
--- xpdf-4.00/goo/gmem.cc.alloc	2017-08-08 19:22:50.000000000 -0400
+++ xpdf-4.00/goo/gmem.cc	2017-08-16 18:01:21.363210992 -0400
@@ -78,8 +78,8 @@ static int gMaxMemInUse = 0;
 #endif /* DEBUG_MEM */
 
 #ifdef DEBUG_MEM
-void *gmalloc(int size, int ignore) GMEM_EXCEP {
-  int size1;
+void *gmalloc(size_t size, int ignore) GMEM_EXCEP {
+  size_t size1;
   char *mem;
   GMemHdr *hdr;
   void *data;
@@ -128,7 +128,7 @@ void *gmalloc(int size, int ignore) GMEM
   return data;
 }
 #else
-void *gmalloc(int size) GMEM_EXCEP {
+void *gmalloc(size_t size) GMEM_EXCEP {
   void *p;
 
   if (size < 0) {
@@ -144,11 +144,11 @@ void *gmalloc(int size) GMEM_EXCEP {
 }
 #endif
 
-void *grealloc(void *p, int size) GMEM_EXCEP {
+void *grealloc(void *p, size_t size) GMEM_EXCEP {
 #ifdef DEBUG_MEM
   GMemHdr *hdr;
   void *q;
-  int oldSize;
+  size_t oldSize;
 
   if (size < 0) {
     gMemError("Invalid memory allocation size");
@@ -224,7 +224,7 @@ void *greallocn(void *p, int nObjs, int
 
 void gfree(void *p) {
 #ifdef DEBUG_MEM
-  int size;
+  size_t size;
   GMemHdr *hdr;
   unsigned long *trl, *clr;
 
diff -up xpdf-4.00/goo/gmem.h.alloc xpdf-4.00/goo/gmem.h
--- xpdf-4.00/goo/gmem.h.alloc	2017-08-16 17:59:32.770952926 -0400
+++ xpdf-4.00/goo/gmem.h	2017-08-16 18:02:14.289874604 -0400
@@ -37,16 +37,16 @@ extern "C" {
  * returns NULL.
  */
 #ifdef DEBUG_MEM
-extern void *gmalloc(int size, int ignore = 0) GMEM_EXCEP;
+extern void *gmalloc(size_t size, int ignore = 0) GMEM_EXCEP;
 #else
-extern void *gmalloc(int size) GMEM_EXCEP;
+extern void *gmalloc(size_t size) GMEM_EXCEP;
 #endif
 
 /*
  * Same as realloc, but prints error message and exits if realloc()
  * returns NULL.  If <p> is NULL, calls malloc instead of realloc().
  */
-extern void *grealloc(void *p, int size) GMEM_EXCEP;
+extern void *grealloc(void *p, size_t size) GMEM_EXCEP;
 
 /*
  * These are similar to gmalloc and grealloc, but take an object count
