mozilla/pdf.js — pull request #4184 by Snuffleupagus (2014-01-24 20:49:48+00:00)
Title: Fix loading of fonts with empty font file (bug 866395)

The issue as reported on Bugzilla is fixed by this change: [fonts.js#5976](https://github.com/Snuffleupagus/pdf.js/blob/71714c0e5e18887ecc4f5157151ee6cbb169a9c7/src/core/fonts.js#L5976). Note however that the actual issue is that one of the fonts in that document contains an empty font file, which is what causes an infinite loop.

To solve this properly, we need to check if font files are empty before trying to load them. I choose to do this by checking the length of the font file, since that seemed like the simplest way.

Unfortunately, in this particular file, the font data use the "FlateDecode" filter. The current PDF.js implementation doesn't have a `length` method for these kind of streams, so I've tried to implement this.
*I'm slightly unsure about whether this is the correct way to implement that property though!*

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=866395.