Reranko05 commented on code in PR #50500:
URL: https://github.com/apache/arrow/pull/50500#discussion_r4057633849


##########
cpp/src/arrow/util/key_value_metadata.cc:
##########
@@ -121,11 +124,23 @@ Status KeyValueMetadata::DeleteMany(std::vector<int64_t> 
indices) {
     ++shift;
     const auto start = indices[i] + 1;
     const auto stop = indices[i + 1];
-    DCHECK_GE(start, 0);
-    DCHECK_LE(start, size);
-    DCHECK_GE(stop, 0);
-    DCHECK_LE(stop, size);
+
+    if (ARROW_PREDICT_TRUE(start < 0 || start > size)) {
+      return Status::IndexError("KeyValueMetadata::DeleteMany: Start index ", 
start - 1,
+                                " out of bounds for metadata of size ", size);
+    }

Review Comment:
   nit: Can you use `ARROW_PREDICT_FALSE` for error branches. (Have not 
analysed the full code, just caught this.)



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