adamreeve commented on code in PR #43413:
URL: https://github.com/apache/arrow/pull/43413#discussion_r1724144744
##########
cpp/src/parquet/encryption/encryption_internal.cc:
##########
@@ -758,9 +795,14 @@ void QuickUpdatePageAad(int32_t new_page_ordinal,
std::string* AAD) {
std::memcpy(AAD->data() + AAD->length() - 2, page_ordinal_bytes.data(), 2);
}
-void RandBytes(unsigned char* buf, int num) {
+void RandBytes(unsigned char* buf, size_t num) {
+ if (num > static_cast<size_t>(std::numeric_limits<int>::max())) {
+ std::stringstream ss;
+ ss << "Length " << num << " for RandBytes overflows int";
+ throw ParquetException(ss.str());
+ }
openssl::EnsureInitialized();
- RAND_bytes(buf, num);
+ RAND_bytes(buf, static_cast<int>(num));
Review Comment:
Ok cool, I've added the check now
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]