1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #18304 from Snuffleupagus/issue-18298

Don't throw if there's not enough data to get the header in `FlateStream` (issue 18298)
This commit is contained in:
Jonas Jenwald 2024-06-20 13:53:26 +02:00 committed by GitHub
commit e76242d4ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View file

@ -296,10 +296,15 @@ class FlateStream extends DecodeStream {
}
readBlock() {
let buffer, len;
let buffer, hdr, len;
const str = this.str;
// read block header
let hdr = this.getBits(3);
try {
hdr = this.getBits(3);
} catch (ex) {
this.#endsStreamOnError(ex.message);
return;
}
if (hdr & 1) {
this.eof = true;
}

View file

@ -0,0 +1 @@
https://github.com/user-attachments/files/15908428/example-malformed.pdf

View file

@ -5438,6 +5438,15 @@
"lastPage": 1,
"type": "eq"
},
{
"id": "issue18298",
"file": "pdfs/issue18298.pdf",
"md5": "30a6108220c41ec88fa92ff45924a6cb",
"rounds": 1,
"link": true,
"lastPage": 1,
"type": "eq"
},
{
"id": "issue18138",
"file": "pdfs/issue18138.pdf",