Bug 689835 - Unnecessary error "run length with no antecedent" thrown from jbig2dec on initial runcode 33 or 34.
Summary: Unnecessary error "run length with no antecedent" thrown from jbig2dec on ini...
Status: RESOLVED FIXED
Alias: None
Product: jbig2dec
Classification: Unclassified
Component: Rendering (show other bugs)
Version: master
Hardware: All All
: P4 normal
Assignee: Ralph Giles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-12 14:05 UTC by Justin Greer
Modified: 2009-03-30 17:57 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Greer 2008-05-12 14:05:30 UTC
If a set of runcodes starts with runcode 32 through 34, jbig2dec throws an
"error decoding symbol id table: run length with no antecedent!" because no
previous runcode was defined, from which to copy the PREFIXLEN.  

However, this check should only apply to runcode 32, since 33 and 34 use a
PREFIXLEN of zero.

Patch:


Index: jbig2_text.c
===================================================================
--- jbig2_text.c	(revision 464)
+++ jbig2_text.c	(working copy)
@@ -141,13 +141,13 @@
 	    len = code;
 	    range = 1;
 	  } else {
-	    if (index < 1) {
-	      jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
-		"error decoding symbol id table: run length with no antecedent!");
-	      /* todo: memory cleanup */
-	      return -1;
-	    }
 	    if (code == 32) {
+    	    if (index < 1) {
+    	      jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
+    		"error decoding symbol id table: run length with no antecedent!");
+    	      /* todo: memory cleanup */
+    	      return -1;
+    	    }
 	      len = symcodelengths[index-1].PREFLEN;
 	    } else {
 	      len = 0; /* code == 33 or 34 */
Comment 1 Ralph Giles 2009-03-30 17:57:32 UTC
Oops. Committed this to the jbig2dec tree almost a year ago. Forgot to close the
bug. Thanks for the patch. Do you have an example file you can share?