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:
commit
97dc048e56
4 changed files with 7097 additions and 1 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue