[jbig2-cvs] rev 435 - trunk

giles at ghostscript.com giles at ghostscript.com
Mon Dec 5 16:02:26 PST 2005


Author: giles
Date: 2005-08-31 09:41:42 -0700 (Wed, 31 Aug 2005)
New Revision: 435

Modified:
   trunk/jbig2.c
Log:
Make a Jbig2WordStream return zeros past the end of the defined
buffer, as can happen when the huffman decoder tries to fill
its 'next_word' lookahead near the end of a segment.

Previously, we just relied on there being some data we could
read (and then ignore) which usually worked, but caused a
segfault with the 688080.pdf test file due to chance read
buffer alignment.



Modified: trunk/jbig2.c
===================================================================
--- trunk/jbig2.c	2005-08-30 02:05:05 UTC (rev 434)
+++ trunk/jbig2.c	2005-08-31 16:41:42 UTC (rev 435)
@@ -400,6 +400,8 @@
   if (offset + 4 < z->size)
     result = (data[offset] << 24) | (data[offset + 1] << 16) |
       (data[offset + 2] << 8) | data[offset + 3];
+  else if (offset >= z->size)
+    return 0;
   else
     {
       int i;



More information about the jbig2-cvs mailing list