mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-05 08:02:11 +00:00
pad and hope for the best of AES input buffer is not a multiple of 16
git-svn-id: svn+q:///qpdf/trunk@944 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
parent
75b55b7aad
commit
95114fe256
@ -102,10 +102,15 @@ Pl_AES_PDF::finish()
|
|||||||
{
|
{
|
||||||
if (this->offset != this->buf_size)
|
if (this->offset != this->buf_size)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
// This is never supposed to happen as the output is
|
||||||
"aes encrypted stream length was not a multiple of " +
|
// always supposed to be padded. However, we have
|
||||||
QUtil::int_to_string(this->buf_size) + " bytes (offset = " +
|
// encountered files for which the output is not a
|
||||||
QUtil::int_to_string(this->offset) + ")");
|
// multiple of the block size. In this case, pad with
|
||||||
|
// zeroes and hope for the best.
|
||||||
|
assert(this->buf_size > this->offset);
|
||||||
|
std::memset(this->inbuf + this->offset, 0,
|
||||||
|
this->buf_size - this->offset);
|
||||||
|
this->offset = this->buf_size;
|
||||||
}
|
}
|
||||||
flush(true);
|
flush(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user