mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-16 09:37:08 +00:00
Validate key length in Pl_AES_PDF constructor
This commit is contained in:
parent
54cf0e519c
commit
64e9839710
@ -149,6 +149,7 @@ set(CORPUS_OTHER
|
||||
99999e.fuzz
|
||||
369662293.fuzz
|
||||
369662293a.fuzz
|
||||
377977949.fuzz
|
||||
)
|
||||
|
||||
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 $n_qpdf_files = 86; # increment when adding new files
|
||||
my $n_qpdf_files = 87; # increment when adding new files
|
||||
|
||||
my @fuzzers = (
|
||||
['ascii85' => 1],
|
||||
|
@ -23,6 +23,9 @@ Pl_AES_PDF::Pl_AES_PDF(
|
||||
if (!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);
|
||||
std::memcpy(this->key.get(), key, key_bytes);
|
||||
std::memset(this->inbuf, 0, this->buf_size);
|
||||
|
Loading…
Reference in New Issue
Block a user