shithub: jbig2

Download patch

ref: f901b18ac90d291b98a1463e92f8d26c6f320c3e
parent: 58b513e3ec60feac13ea429c4aff12ea8a8de91d
author: masaki <masaki@a1074d23-0009-0410-80fe-cf8c14f379e6>
date: Tue Apr 13 05:50:08 EDT 2010

A fix for 691081, 691206, and part of 690094.

From r9769, jbig2dec wasn't capable of decoding some JBIG2 files
and throwing a error "jbig2dec FATAL ERROR runlength too large in
export symbol table (XXX > XX - XX) (segment 0xXX)".
This was caused by accidentaly bound checking export symbol table
size with number of non-export symbol.  This fixes it.
No differences expected, other than JBIG2 files suffered from this
problem.

git-svn-id: http://svn.ghostscript.com/ghostscript/trunk/gs/jbig2dec/@11057 a1074d23-0009-0410-80fe-cf8c14f379e6
(cherry picked from commit e2c24fec806a2a84427ecfff9a9bbd078ca460bd)

Signed-off-by: Masaki Ushizaka <masaki@ghostscript.com>

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -696,7 +696,7 @@
         exrunlength = params->SDNUMEXSYMS;
       else
         code = jbig2_arith_int_decode(IAEX, as, &exrunlength);
-      if (exrunlength > params->SDNUMEXSYMS - j) {
+      if (exflag && exrunlength > params->SDNUMEXSYMS - j) {
         jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
           "runlength too large in export symbol table (%d > %d - %d)\n",
           exrunlength, params->SDNUMEXSYMS, j);