1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Always prefer abbreviated keys, over full ones, when doing any dictionary lookups (issue 14256)

Note that issue 14256 was specifically about *inline* images, please refer to:
 - https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G7.1852045
 - https://www.pdfa.org/safedocs-unearths-pdf-inline-image-issue/
 - https://pdf-issues.pdfa.org/32000-2-2020/clause08.html#H8.9.7

However, during review of the initial PR in https://github.com/mozilla/pdf.js/pull/14257#issuecomment-964469710, it was suggested that we instead do this *unconditionally for all* dictionary lookups.
In addition to re-ordering the existing call-sites in the `src/core`-code, and adding non-PRODUCTION/TESTING asserts to catch future errors, for consistency a number of existing `if`/`switch`-blocks were re-factored to also check the abbreviated keys first.
This commit is contained in:
Jonas Jenwald 2021-11-09 22:39:21 +01:00
parent 4ee906adf4
commit ea1c348c67
12 changed files with 730 additions and 104 deletions

View file

@ -43,7 +43,7 @@ class PredictorStream extends DecodeStream {
this.dict = str.dict;
const colors = (this.colors = params.get("Colors") || 1);
const bits = (this.bits = params.get("BitsPerComponent") || 8);
const bits = (this.bits = params.get("BPC", "BitsPerComponent") || 8);
const columns = (this.columns = params.get("Columns") || 1);
this.pixBytes = (colors * bits + 7) >> 3;