Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch decodeParams if it's a |Ref| in JBIG2Decode streams #5284

Merged
merged 1 commit into from
Sep 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,8 @@ var Jbig2Stream = (function Jbig2StreamClosure() {

var jbig2Image = new Jbig2Image();

var chunks = [], decodeParams = this.dict.get('DecodeParms');
var chunks = [], xref = this.dict.xref;
var decodeParams = xref.fetchIfRef(this.dict.get('DecodeParms'));

// According to the PDF specification, DecodeParms can be either
// a dictionary, or an array whose elements are dictionaries.
Expand All @@ -1042,7 +1043,7 @@ var Jbig2Stream = (function Jbig2StreamClosure() {
warn('JBIG2 - \'DecodeParms\' array with multiple elements ' +
'not supported.');
}
decodeParams = decodeParams[0];
decodeParams = xref.fetchIfRef(decodeParams[0]);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we move it before isArray check? Arrays can be referred by ref too

Could you also add var xref = this.dict.xref;?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving it seems reasonable, but we also need it in the isArray case otherwise we don't actually fix the bug.
The xref variable has been added.

if (decodeParams && decodeParams.has('JBIG2Globals')) {
var globalsStream = decodeParams.get('JBIG2Globals');
Expand Down