1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Merge pull request #14350 from Snuffleupagus/ccitt-infinite-loop

Prevent an infinite loop when parsing corrupt /CCITTFaxDecode data (issue 14305)
This commit is contained in:
Tim van der Meij 2021-12-08 20:01:21 +01:00 committed by GitHub
commit 97dc048e56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)) {