shithub: jbig2

Download patch

ref: 50493055b3f099f6670df3ab2011af8085ba49c5
parent: 28e7ac27b12c59c271eacca8eb70dc97fe991c5b
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Mon Dec 20 19:35:02 EST 2004

Re-assign the return value of jbig2_realloc() when growning the page 
size array. Previously it was dropped which could cause crashes on some 
systems processing documents with more than 4 pages. Thanks to Jan 
Patera for reporting this.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@367 ded80894-8fb9-0310-811b-c03f3676ab4d

--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,6 @@
 Version 0.8 (unreleased)
 
- * no changes as of yet
+ * Fix an allocation error in the page array
 
 Version 0.7 (2004 December 8)
 
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -85,7 +85,8 @@
             index++;
             if (index >= ctx->max_page_index) { /* FIXME: should also look for freed pages? */
                 /* grow the list */
-                jbig2_realloc(ctx->allocator, ctx->pages, (ctx->max_page_index <<= 2) * sizeof(Jbig2Page));
+                ctx->pages = jbig2_realloc(ctx->allocator, ctx->pages,
+			(ctx->max_page_index <<= 2) * sizeof(Jbig2Page));
                 for (j=index; j < ctx->max_page_index; j++) {
                     /* note to raph: and look, it gets worse! */
                     ctx->pages[j].state = JBIG2_PAGE_FREE;