You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2022/04/25 20:23:20 UTC

[arrow] branch master updated: ARROW-16225: [C++][Parquet] Fix length of encryption AAD random byte generation

This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 4010916f86 ARROW-16225: [C++][Parquet] Fix length of encryption AAD random byte generation
4010916f86 is described below

commit 4010916f864783b2a8e7a7d1a9d0187060ec47e7
Author: Maya Anderson <ma...@il.ibm.com>
AuthorDate: Mon Apr 25 22:23:05 2022 +0200

    ARROW-16225: [C++][Parquet] Fix length of encryption AAD random byte generation
    
    sizeof is indeed unnecessary here.
    And no need to initialize the buffer to 0 either before using rand_bytes(), if the AAD is the full length of the buffer.
    
    Closes #12935 from andersonm-ibm/rand_bytes
    
    Authored-by: Maya Anderson <ma...@il.ibm.com>
    Signed-off-by: Antoine Pitrou <an...@python.org>
---
 cpp/src/parquet/encryption/encryption.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/cpp/src/parquet/encryption/encryption.cc b/cpp/src/parquet/encryption/encryption.cc
index 5927503aba..731120d9a6 100644
--- a/cpp/src/parquet/encryption/encryption.cc
+++ b/cpp/src/parquet/encryption/encryption.cc
@@ -389,8 +389,7 @@ FileEncryptionProperties::FileEncryptionProperties(
          footer_key.length() == 32);
 
   uint8_t aad_file_unique[kAadFileUniqueLength];
-  memset(aad_file_unique, 0, kAadFileUniqueLength);
-  encryption::RandBytes(aad_file_unique, sizeof(kAadFileUniqueLength));
+  encryption::RandBytes(aad_file_unique, kAadFileUniqueLength);
   std::string aad_file_unique_str(reinterpret_cast<char const*>(aad_file_unique),
                                   kAadFileUniqueLength);