Skip to content

[Bug]: pdf.js doesn't lex 5f properly #20735

@jrmuizel

Description

@jrmuizel

Attach (recommended) or Link to PDF file

lex-diff.pdf

Web browser and its version

Firefox Nightly

Operating system and its version

macOS

PDF.js version

recent

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. Load lex-diff.pdf
  2. Observe a large red rectangle

What is the expected behavior?

The PDF should not have a red rectangle. Acrobat, Preview and PDFium do not have a red rectangle.

What went wrong?

In a PDF stream like:

q
1 0 0 rg
100 450 400 150 re
5f
Q

pdf.js will lex 5f as Number(5), Keyword(f).

From PDF spec 7.2.3:

"All characters except the white-space characters and delimiters are referred to as regular characters. These characters include bytes that are outside the ASCII character set. A sequence of consecutive regular characters comprises a single token."

Link to a viewer

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions