mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Merge pull request #1308 from m-holger/fuzz
Validate key length in Pl_AES_PDF constructor
This commit is contained in:
commit
3ea83e9993
@ -149,6 +149,7 @@ set(CORPUS_OTHER
|
|||||||
99999e.fuzz
|
99999e.fuzz
|
||||||
369662293.fuzz
|
369662293.fuzz
|
||||||
369662293a.fuzz
|
369662293a.fuzz
|
||||||
|
377977949.fuzz
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)
|
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)
|
||||||
|
BIN
fuzz/qpdf_extra/377977949.fuzz
Normal file
BIN
fuzz/qpdf_extra/377977949.fuzz
Normal file
Binary file not shown.
@ -11,7 +11,7 @@ my $td = new TestDriver('fuzz');
|
|||||||
|
|
||||||
my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS";
|
my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS";
|
||||||
|
|
||||||
my $n_qpdf_files = 86; # increment when adding new files
|
my $n_qpdf_files = 87; # increment when adding new files
|
||||||
|
|
||||||
my @fuzzers = (
|
my @fuzzers = (
|
||||||
['ascii85' => 1],
|
['ascii85' => 1],
|
||||||
|
@ -23,6 +23,9 @@ Pl_AES_PDF::Pl_AES_PDF(
|
|||||||
if (!next) {
|
if (!next) {
|
||||||
throw std::logic_error("Attempt to create Pl_AES_PDF with nullptr as next");
|
throw std::logic_error("Attempt to create Pl_AES_PDF with nullptr as next");
|
||||||
}
|
}
|
||||||
|
if (!(key_bytes == 32 || key_bytes == 16)) {
|
||||||
|
throw std::runtime_error("unsupported key length");
|
||||||
|
}
|
||||||
this->key = std::make_unique<unsigned char[]>(key_bytes);
|
this->key = std::make_unique<unsigned char[]>(key_bytes);
|
||||||
std::memcpy(this->key.get(), key, key_bytes);
|
std::memcpy(this->key.get(), key, key_bytes);
|
||||||
std::memset(this->inbuf, 0, this->buf_size);
|
std::memset(this->inbuf, 0, this->buf_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user