wgtmac commented on code in PR #2622:
URL: https://github.com/apache/orc/pull/2622#discussion_r3302111385


##########
c++/src/BlockBuffer.cc:
##########
@@ -70,10 +81,19 @@ namespace orc {
 
   void BlockBuffer::reserve(uint64_t newCapacity) {
     while (currentCapacity_ < newCapacity) {
+      uint64_t nextCapacity = 0;
+      if (addWithOverflow(currentCapacity_, blockSize_, &nextCapacity)) {
+        throw std::length_error("Block buffer capacity overflow");
+      }
       char* newBlockPtr = memoryPool_.malloc(blockSize_);
       if (newBlockPtr != nullptr) {
-        blocks_.push_back(newBlockPtr);
-        currentCapacity_ += blockSize_;
+        try {

Review Comment:
   Why do we need this try-catch block?



-- 
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]

Reply via email to