shithub: jbig2

Download patch

ref: e4e8acebad09764a3be793082de99bd1679ef0c0
parent: 46555913d6ed4b5479b50f45564ed94c478af863
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Fri May 9 09:54:32 EDT 2008

Runcodes 33 and 34 repeat a zero code length symbol id, not the previous
symbol like runcode 32.

Thanks to Justin Greer for the fix. Ghostscript bug 689824.


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

--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -147,7 +147,11 @@
 	      /* todo: memory cleanup */
 	      return -1;
 	    }
-	    len = symcodelengths[index-1].PREFLEN;
+	    if (code == 32) {
+	      len = symcodelengths[index-1].PREFLEN;
+	    } else {
+	      len = 0; /* code == 33 or 34 */
+	    }
 	    if (code == 32) range = jbig2_huffman_get_bits(hs, 2) + 3;
 	    else if (code == 33) range = jbig2_huffman_get_bits(hs, 3) + 3;
 	    else if (code == 34) range = jbig2_huffman_get_bits(hs, 7) + 11;