| Summary: | Unnecessary error "run length with no antecedent" thrown from jbig2dec on initial runcode 33 or 34. | ||
|---|---|---|---|
| Product: | jbig2dec | Reporter: | Justin Greer <ghostscript.com> |
| Component: | Rendering | Assignee: | Ralph Giles <ralph.giles> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P4 | ||
| Version: | master | ||
| Hardware: | All | ||
| OS: | All | ||
| Customer: | Word Size: | --- | |
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? |
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 */