ref: e6bea5d638a547edb30542eb08882318f2c3a444
parent: 37a6758bad72796bfa2422fdb951608850b994c9
author: Sebastian Rasmussen <sebras@gmail.com>
date: Sun Jul 1 09:03:01 EDT 2018
jbig2dec: Handle text regions without symbol dictionaries. Normal text regions reference symbol dictionaries. The symbols in those dictionaries are then referenced to by the text region and placed somewhere on the page. In the degenerate case a text region might not have any instances of symbols that it wants to place on the page. If that is the case then there is no need for the text region to refer to any symbol dictionaries (since it doesn't need any symbols). Previously this was treated as a fatal error, but now this just creates a warning and decoding proceeds.
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -860,27 +860,26 @@
/* 7.4.3.2 (2) - compose the list of symbol dictionaries */
n_dicts = jbig2_sd_count_referred(ctx, segment);
- if (n_dicts != 0) {
- dicts = jbig2_sd_list_referred(ctx, segment);
+ if (n_dicts == 0) {
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "text region refers to no symbol dictionaries");
} else {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region refers to no symbol dictionaries");
- goto cleanup1;
- }
- if (dicts == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unable to retrieve symbol dictionaries! previous parsing error?");
- goto cleanup1;
- } else {
- uint32_t index;
-
- if (dicts[0] == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find first referenced symbol dictionary");
+ dicts = jbig2_sd_list_referred(ctx, segment);
+ if (dicts == NULL) {
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unable to retrieve symbol dictionaries! previous parsing error?");
goto cleanup1;
- }
- for (index = 1; index < n_dicts; index++)
- if (dicts[index] == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find all referenced symbol dictionaries");
- n_dicts = index;
+ } else {
+ uint32_t index;
+
+ if (dicts[0] == NULL) {
+ code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find first referenced symbol dictionary");
+ goto cleanup1;
}
+ for (index = 1; index < n_dicts; index++)
+ if (dicts[index] == NULL) {
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find all referenced symbol dictionaries");
+ n_dicts = index;
+ }
+ }
}
/* 7.4.3.2 (3) */