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

Prevent an infinite loop when parsing corrupt /CCITTFaxDecode data (issue 14305)

Fixes one of the documents in issue 14305.
This commit is contained in:
Jonas Jenwald 2021-12-07 13:16:38 +01:00
parent c42b19f26a
commit e8562173b8
4 changed files with 7097 additions and 1 deletions

View file

@ -19,7 +19,7 @@
* license.
*/
import { info } from "../shared/util.js";
import { FormatError, info } from "../shared/util.js";
/**
* @typedef {Object} CCITTFaxDecoderSource
@ -811,6 +811,12 @@ class CCITTFaxDecoder {
bits = 8;
c = 0;
do {
if (typeof this.outputBits !== "number") {
throw new FormatError(
'Invalid /CCITTFaxDecode data, "outputBits" must be a number.'
);
}
if (this.outputBits > bits) {
c <<= bits;
if (!(this.codingPos & 1)) {