question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempt to remove usage of `makeSubStream` in src/core/type1_parser.js

See original GitHub issue

I was recently sorting through and throwing out old notes, when I found this and figured it wouldn’t hurt to at least submit an issue.

In Type1Parser, there’s currently two usages of makeSubStream that seem completely unnecessary; see https://github.com/mozilla/pdf.js/blob/7ba50448fdef660d22b799b5814af36ad63407c4/src/core/type1_parser.js#L562-L566 and https://github.com/mozilla/pdf.js/blob/7ba50448fdef660d22b799b5814af36ad63407c4/src/core/type1_parser.js#L585-L589

Using makeSubStream in that fashion makes the code look more convoluted than necessary, and should also be less efficient since it causes a new Stream to be initialized when all that’s really needed here is to get a known number of bytes from the already available stream.

At least in theory, although testing is obviously required, it should be possible to replace each of those blocks with the following code instead

lenIV = program.properties.privateData['lenIV'];
encoded = this.readCharStrings(stream.getBytes(length), lenIV);

Since this issue could potentially be a candidate for the 5-good-beginner-bug label, I’m including a link to https://github.com/mozilla/pdf.js/wiki/Contributing for good measure. Especially the sections “Generating reference images” and “Run testing” is of particular importance, for anyone wanting to work on this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
timvandermeijcommented, May 20, 2018

It requires #9696 to be fixed first. I’d say for now you can ignore those files because our test bot has them and we’ll trigger the test bot for a pull request anyway.

0reactions
timvandermeijcommented, May 25, 2018

The pull request itself looks good, but we are having some problems with our testing infrastructure that prevent us from merging it. After that’s done, this issue will be closed automatically.

Read more comments on GitHub >

github_iconTop Results From Across the Web

compromised npm packages of ua-parser-js (0.7.29, 0.8.0, 1.0.0)
First question - Can we use range ^0.7.28 , or it is not safe? Second question - Will you create a new package,...
Read more >
ua-parser-js - npm
JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data with relatively small footprint (~17KB ...
Read more >
How to remove " from my Json in javascript?
Presumably you have it in a variable and are using JSON.parse(data); . In which case, use: JSON.parse(data.replace(/"/g,'"'));.
Read more >
Popular NPM library hijacked to install password-stealers ...
The UA-Parser-JS library is used to parse a browser's user agent to identify a visitor's browser, engine, OS, CPU, and Device type/model.
Read more >
UAParser.js - Detect Browser, Engine, OS, CPU, and Device ...
Started from JavaScript approach, {UAParser.js} is optimized to be used with browser. While it covers a vast range of detection, the size always...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found