b***@artifex.com
2017-11-24 09:18:20 UTC
http://bugs.ghostscript.com/show_bug.cgi?id=698776
Bug ID: 698776
Summary: jbig2dec fails to parse "immediate generic region"
segment with unspecified length
Product: jbig2dec
Version: 0.14
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: P4
Component: Parsing
Assignee: ***@artifex.com
Reporter: ***@pdflib.com
QA Contact: gs-***@ghostscript.com
Word Size: ---
Created attachment 14488
--> http://bugs.ghostscript.com/attachment.cgi?id=14488&action=edit
JBIG2 image with "immediate generic region"
How to reproduce:
Invoke jbig2dec 0.14 like this:
$ ./jbig2dec -v 9 -o bug5200.png bug5200_p1_I1.jbig2
jbig2dec info file header indicates a single page document
jbig2dec DEBUG file header indicates sequential organization
jbig2dec DEBUG segment 0 is associated with page 1 (segment 0x00)
jbig2dec info Segment 0, flags=30, type=48, data_length=19 (segment 0x00)
jbig2dec info page 1 image is 196x1159 (7874 ppm) (segment 0x00)
jbig2dec DEBUG allocated 196x1159 page image (28975 bytes) (segment 0x00)
jbig2dec DEBUG segment 1 is associated with page 1 (segment 0x01)
Expected result:
jbig2dec creates PNG file from JBIG2 input file.
Actual result:
No PNG output file is created.
The special property of this file is that it contains an "Immediate generic
region" where the segment header has a value of 0xFFFFFFFF in the "segment data
length" field.
The JBIG2 specification "ISO/IEC 14492 : 2001 (E)" says this in "7.2.7 Segment
data length":
"If the segment's type is "Immediate generic region", then the length field may
contain the value 0xFFFFFFFF. This value is intended to mean that the length of
the segment's data part is unknown at the time that the segment header is
written (for example in a streaming application such as facsimile). ..."
As far as I understood jbig2dec's source code there is no special handling for
this case. In jbig2_data_in() the length of the segment is read, and then when
ctx->state is JBIG2_FILE_SEQUENTIAL_HEADER the following check determines that
there is not enough data available:
case JBIG2_FILE_SEQUENTIAL_BODY:
case JBIG2_FILE_RANDOM_BODIES:
segment = ctx->segments[ctx->segment_index];
if (segment->data_length > ctx->buf_wr_ix - ctx->buf_rd_ix)
return 0; /* need more data */
I assume that here code is be needed to determine the length of the segment by
parsing the "Immediate generic region" segment data.
Bug ID: 698776
Summary: jbig2dec fails to parse "immediate generic region"
segment with unspecified length
Product: jbig2dec
Version: 0.14
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: P4
Component: Parsing
Assignee: ***@artifex.com
Reporter: ***@pdflib.com
QA Contact: gs-***@ghostscript.com
Word Size: ---
Created attachment 14488
--> http://bugs.ghostscript.com/attachment.cgi?id=14488&action=edit
JBIG2 image with "immediate generic region"
How to reproduce:
Invoke jbig2dec 0.14 like this:
$ ./jbig2dec -v 9 -o bug5200.png bug5200_p1_I1.jbig2
jbig2dec info file header indicates a single page document
jbig2dec DEBUG file header indicates sequential organization
jbig2dec DEBUG segment 0 is associated with page 1 (segment 0x00)
jbig2dec info Segment 0, flags=30, type=48, data_length=19 (segment 0x00)
jbig2dec info page 1 image is 196x1159 (7874 ppm) (segment 0x00)
jbig2dec DEBUG allocated 196x1159 page image (28975 bytes) (segment 0x00)
jbig2dec DEBUG segment 1 is associated with page 1 (segment 0x01)
Expected result:
jbig2dec creates PNG file from JBIG2 input file.
Actual result:
No PNG output file is created.
The special property of this file is that it contains an "Immediate generic
region" where the segment header has a value of 0xFFFFFFFF in the "segment data
length" field.
The JBIG2 specification "ISO/IEC 14492 : 2001 (E)" says this in "7.2.7 Segment
data length":
"If the segment's type is "Immediate generic region", then the length field may
contain the value 0xFFFFFFFF. This value is intended to mean that the length of
the segment's data part is unknown at the time that the segment header is
written (for example in a streaming application such as facsimile). ..."
As far as I understood jbig2dec's source code there is no special handling for
this case. In jbig2_data_in() the length of the segment is read, and then when
ctx->state is JBIG2_FILE_SEQUENTIAL_HEADER the following check determines that
there is not enough data available:
case JBIG2_FILE_SEQUENTIAL_BODY:
case JBIG2_FILE_RANDOM_BODIES:
segment = ctx->segments[ctx->segment_index];
if (segment->data_length > ctx->buf_wr_ix - ctx->buf_rd_ix)
return 0; /* need more data */
I assume that here code is be needed to determine the length of the segment by
parsing the "Immediate generic region" segment data.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are receiving this mail because:
You are the QA Contact for the bug.