EnricoMi commented on code in PR #46017:
URL: https://github.com/apache/arrow/pull/46017#discussion_r2039322897


##########
cpp/src/parquet/encryption/encryption.cc:
##########
@@ -182,79 +175,75 @@ 
FileEncryptionProperties::Builder::disable_aad_prefix_storage() {
 }
 
 ColumnEncryptionProperties::ColumnEncryptionProperties(bool encrypted,
-                                                       const std::string& 
column_path,
-                                                       const std::string& key,
-                                                       const std::string& 
key_metadata)
-    : column_path_(column_path) {
-  DCHECK(!column_path.empty());
+                                                       std::string column_path,
+                                                       
encryption::SecureString key,
+                                                       std::string 
key_metadata)
+    : column_path_(std::move(column_path)),

Review Comment:
   This moves member initialization from the body, which is the more standard 
way. However, the body could accidentally check input arguments, which after 
`std::move` are "empty".
   
   While this is correct:
   ``
         encrypted_with_footer_key_(encrypted && key.empty()),
         key_(std::move(key)),
   ```
   if members are shuffled around, then this becomes incorrect:
   ```
         key_(std::move(key)),
         encrypted_with_footer_key_(encrypted && key.empty()),
   ```
   as `encrypted_with_footer_key_` is initialized on the "empty" `key`.
   
   Do you consider this pattern too risky for future bugs? Happy to revert this 
initialization.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to