Skip to content

Commit

Permalink
more strict check?
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Jul 11, 2024
1 parent 329abf0 commit f706af0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpp/src/parquet/metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@ class FileMetaData::FileMetaDataImpl {
auto aes_encryptor = encryption::AesEncryptor::Make(file_decryptor_->algorithm(),
static_cast<int>(key.size()),
true, false /*write_length*/);
if (ARROW_PREDICT_FALSE(aes_encryptor == nullptr)) {
throw ParquetException("Could not create AES encryptor for signature verification");
}

std::shared_ptr<Buffer> encrypted_buffer = std::static_pointer_cast<ResizableBuffer>(
AllocateBuffer(file_decryptor_->pool(),
Expand All @@ -662,6 +665,7 @@ class FileMetaData::FileMetaDataImpl {
encrypted_buffer->mutable_data());
// Delete AES encryptor object. It was created only to verify the footer signature.
aes_encryptor->WipeOut();
aes_encryptor = nullptr;
return 0 ==
memcmp(encrypted_buffer->data() + encrypted_len - encryption::kGcmTagLength,
tag, encryption::kGcmTagLength);
Expand Down

0 comments on commit f706af0

Please sign in to comment.