Skip to content

HP Scan invalid Length workaround#215

Open
mfazekas wants to merge 2 commits into
boazsegev:masterfrom
mfazekas:len-wokraround
Open

HP Scan invalid Length workaround#215
mfazekas wants to merge 2 commits into
boazsegev:masterfrom
mfazekas:len-wokraround

Conversation

@mfazekas
Copy link
Copy Markdown

@mfazekas mfazekas commented May 3, 2022

Fixes: #191

It looks that some version of HP Scan produces invalid pdf files. Where the length value would point ot of the file.

8 0 obj
<</Length 2200
/Type
/Metadata
/Subtype 
/XML>>
stream
endstream
endobj

I've added a new relaxed: option to allow read such files.
Not sure if it's any better than #209. More complicated for sure.
Also if we'd need the new option for this?

@RBIII
Copy link
Copy Markdown

RBIII commented Jul 12, 2022

Any idea when this might merge? I added it to my local and it seems to be working

@juliolinarez
Copy link
Copy Markdown

Works for me. Nice solution

@osvaldoalvaradodev
Copy link
Copy Markdown

Any idea when they merge into the main branch of this?

@mfazekas
Copy link
Copy Markdown
Author

@boazsegev I've now rebased the pr to current master

@boazsegev
Copy link
Copy Markdown
Owner

Does this actually solve cases where Length is invalid but still within the file's range?

Wouldn't it be better to test for endsteam and if it's not there search for it while ignoring the Length data?

@mfazekas
Copy link
Copy Markdown
Author

mfazekas commented Nov 15, 2023

@boazsegev thanks much for looking into it.

I've updated my PR:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.0.21 causes previously-consumable PDFs to fail now with RangeError

6 participants